Given an unsorted array of integers, find a triplet with given sum in it.
Given M sorted lists of variable length, print them in sorted order efficiently.
Given a string, calculate its rank among all its lexicographically sorted permutations. For example, consider below lexicographically sorted permutations
The longest common subsequence (LCS) problem is the problem of finding the longest subsequence that is present in given two sequences in the same order. i.e. find a longest sequence which can be obtained from the first original sequence by deleting some items, and from the second original sequence by deleting other items.
Huffman Coding is a algorithm for doing data compression and it forms the basic idea behind file compression. This post talks about fixed length and variable length encoding, uniquely decodable codes, prefix rules and construction of Huffman Tree.
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 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 a set of intervals, print all non-overlapping intervals after merging overlapping intervals.
Given an array of integers, find all distinct combinations of given length where repetition of elements is allowed.
Given an array of integers, find all distinct combinations of given length.
Given an binary array containing 0 and 1, find maximum length sub-array having equal number of 0’s and 1’s.
Given an array of integers, find maximum length sub-array having given sum.
Given an array of integers, check if array contains a sub-array having 0 sum. Also, prints end-points of all such sub-arrays.
Given an array of integers containing duplicates, return the majority element in an array if present. A majority element appears more than n/2 times where n is the size of the array.