Given an integer array a[] of size N and a target sum K, subtract a number from each element such that each element becomes X ( if an element is less than Read more →
Binary Search
16 postsIn a prison, there are N cells. The positions of the cells are given in an array. The Jailer has to place all the prisoners in the cells in an ordered manner Read more →
Given an infinite stream of integers, find the k’th largest element at any point of time. It may be assumed that 1 <= k <= n. Example: Input: stream[] = {10, 20, Read more →
Given three arrays start[], duration[], amount[] of length N. A person can make money of amount[i] working for the time period [start[i], start[i]+duration[i]] on task i. Maximum amount of money a person Read more →
You have to paint n boards of length {L1, L2, L3,…,Ln-1}. There are k painters available and each painter takes t time to paint 1 unit of board. You have to get Read more →
There is given a sum and you have to find whether this sum is resultant of summation of first n natural numbers or not. If it is summation of first n natural Read more →
You have a total of n coins and you want to arrange the coins in staircase shape, where every i-th row must have exactly i coins. You want to find the total Read more →
Mithlesh has ‘N’ buckets each consisting of some fruits. Mithlesh wants to eat at least ‘M’ fruits and so, he decided to set a marker (integer) as maximum as possible such that Read more →
You are given a m*n row wise sorted matrix. The task is to find the common element in all rows of given matrix. Examples: Input : mat[3][4]={{1,3,5,6}, {3,4,7,8}, {1,2,3,4}} Output: 3 Input Read more →
Given an array consisting of integers in range 1 to n consisting of only one duplicate element. Find out the duplicate element in O(logN) time. Examples: Input : 6 1 1 2 Read more →