Welcome To Tutorialspoint.dev
Officially launched 18th May 2019
Backtracking Matrix Amazon

Sudoku Backtracking-7

Given a partially filled 9×9 2D array ‘grid[9][9]’, the goal is to assign digits (from 1 to 9) to the empty cells so that every row, column, and s...
Arrays Backtracking Hash

Given an array A[] and a number x, check for pair in A[] with sum as x

Write a program that, given an array A[] of n numbers and another number x, determines whether or not there exist two elements in S whose sum is exactly x. ...
Arrays Divide and Conquer Binary Search

K-th Element of Two Sorted Arrays

Given two sorted arrays of size m and n respectively, you are tasked with finding the element that would be at the k’th position of the final sorted array. Exa...
Dynamic Programming Matrix Flipkart

Gold Mine Problem

Given a gold mine of n*m dimensions. Each field in this mine contains a positive integer which is the amount of gold in tons. Initially the miner is at first column b...
Arrays Dynamic Programming binary-string

Count number of binary strings without consecutive 1’s

Given a positive integer N, count all possible distinct binary strings of length N such that there are no consecutive 1’s. Examples: Input: N = 2 Output: 3 //...
Greedy Activity Selection Problem Amazon

Activity Selection Problem Greedy Algo-1

Greedy is an algorithmic paradigm that builds up a solution piece by piece, always choosing the next piece that offers the most obvious and immediate benefit. Greedy...
Mathematical Flipkart number-digits

K-th digit in ‘a’ raised to power ‘b’

Given three numbers a, b and k, find k-th digit in ab from right side Examples: Input : a = 3, b = 3, k = 1 Output : 7 Explanation 3^3 = 27 for k = 1. First ...
Arrays Divide and Conquer Sorting

Count Inversions in an array Set 1 (Using Merge Sort)

Inversion Count for an array indicates – how far (or close) the array is from being sorted. If array is already sorted then inversion count is 0. If array is ...
Arrays Sorting Flipkart

Chocolate Distribution Problem

Given an array of n integers where each value represents number of chocolates in a packet. Each packet can have variable number of chocolates. There are m students, t...
Arrays Searching Adobe

Search an element in a sorted and rotated array

An element in a sorted array can be found in O(log n) time via binary search. But suppose we rotate an ascending order sorted array at some pivot unknown to you befo...

Subscribe to Our Newsletter