Given an array and an integer k, find the count of distinct elements in every sub-array of size k in the array. Get great deals at Amazon
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. The value of root node will be i if -1 is present at index i in the array. It may be assumed …
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 in C++ and Java programming langauge.
In trapping rain water problem, we need to find the maximum amount of water that can be trapped within given set of bars where width of each bar is 1 unit.
Given two sorted array of integers, find a maximum sum 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 …