Given an array A which represents a binary tree such that the parent-child relationship is defined by (A[i], i) for every index i in the array A, build binary tree out of it.
Given a linked list containing 0’s, 1’s and 2’s, sort linked list by doing single traversal of it.
Write an efficient program to convert number to words.
Find maximum amount of water that can be trapped within given set of bars. Assume width of each bar is 1 unit.
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.
Given an array of integers, find contiguous subarray within it which has the largest sum.
Given a limited range array of size n where array contains elements between 1 to n-1 with one element repeating, find the duplicate number in it.
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.
Given an array containing only 0’s, 1’s and 2’s, sort the array in linear time and using constant space.
Given a Binary Tree, determine if it is a BST or not. This problem has a simple recursive solution. The BST property “every node on the right subtree has to be larger than the current node and every node on the left subtree has to be smaller than the current node” is the key …
A Binary Search Tree (BST) is a rooted binary tree, whose nodes each store a key (and optionally, an associated value) and each have two distinguished sub-trees, commonly denoted left and right. The tree should satisfy the BST property, which states that the key in each node must be greater than all keys stored …
Given a binary tree, in-place convert it to a Doubly Linked List.