Given M sorted lists of variable length, print them in sorted order efficiently.
Given two Boolean arrays X and Y, find the length of longest continuous sequence that starts and ends at same index in both arrays and have same sum. In other words, find max(j-i+1) for every j >= i where sum of sub-array X[i, j] is equal to sum of sub-array Y[i, j].
Implement Quicksort efficiently for inputs containing many repeated elements. Quicksort exhibits poor performance for inputs that contain many repeated elements. The problem is clearly visible when all the input elements are equal. Then at each recursion, the left partition is empty (no input values are less than the pivot), and the right partition …
In this article, we will implement Ternary Search algorithm and compare its performance with Binary Search.
Given a positive number N, find all combinations of 2*N elements such that every element from 1 to N appears exactly twice and distance between its two appearances is exactly equal to value of the element.
Given an array of integers, find sub-array in it that has maximum product of its elements.
The longest increasing subsequence problem is to find a subsequence of a given sequence in which the subsequence’s elements are in sorted order, lowest to highest, and in which the subsequence is as long as possible. This subsequence is not necessarily contiguous, or unique.
Given a list containing future prediction of share prices, find maximum profit that can be earned by buying and selling shares any number of times with constraint that a new transaction can only start after previous transaction is complete. i.e. we can only hold at-most one share at a time.
Find maximum amount of water that can be trapped within given set of bars. Assume width of each bar is 1 unit.
Given a schedule containing arrival and departure time of trains in a station, find minimum number of platforms needed in the station so to avoid any delay in arrival of any train.
Given an array of integers, find the maximum sum of subsequence of given array where subsequence contains no adjacent elements.
Given a set of intervals, print all non-overlapping intervals after merging overlapping intervals.
Given a sequence consisting of ‘I’ and ‘D’ where ‘I’ denotes increasing sequence and ‘D’ denotes the decreasing sequence. Decode the given sequence to construct minimum number without repeated digits.
Given two sorted array of integers, find a path involving elements of both arrays whose sum is maximum. We can start from either arrays but we can switch between arrays only through its common elements.