Given N lists of words, print all combinations of phrases that can be formed by picking one word each from each of the given lists.
Given a linked list, rearrange it by separating odd nodes from even ones. All even nodes should come before all odd nodes in the output list and the relative order of even and odd nodes should be maintained.
Given an integer, reverse its bits using binary operators and lookup table in O(1) time.
Write an algorithm to generate any one of the given N numbers according to given probabilities.
Given a binary tree, find maximum difference between a node and its descendants in it.
Given an sorted array of integers, find a pair in it having minimum absolute sum.
Given a collection of integers, develop an algorithm to find the index of maximum occurring element with equal probability.
In this post, we will discuss how to generate fair results from a biased coin which prefer one side of the coin over another, and returns TAILS with p probability and HEADS with (1-p) probability
Given an array of integers, check if an array is formed by consecutive integers.
Given an unsorted array of integers, find two non-overlapping pairs in it having same sum.
In Pots of gold game, there are two players A & B and pots of gold arranged in a line, each containing some gold coins. The players can see how many coins are there in each gold pot and each player gets alternating turns in which the player can pick a pot from one of …
Given a binary tree, write an efficient algorithm to print right view of given binary tree.