摘要:
Given a binary tree, where every node value is a number . Find the sum of all the numbers which are formed from root to leaf paths. For example consid 阅读全文
摘要:
Given an array, find the minimum length unsorted subarray. After soring this unsorted subarray, the whole array is sorted. Example, if the input array 阅读全文
摘要:
Given an array of integers, write a program that cyclically rotates the array by one. Example: given {1,2,3,4,5}, your program should rotate the array 阅读全文
摘要:
Given a binary tree, convert it to its mirror tree. Mirror of a binary tree T is another binary tree M with the left and right children of all non-lea 阅读全文
摘要:
Given a singly linked list whose nodes contain an integer as their keys. All keys are distinct. Swap the node that has key x with the node that has ke 阅读全文
摘要:
Given a set of distinct integers, return all possible subsets. Notice Elements in a subset must be in non-descending order. The solution set must not 阅读全文
摘要:
Given a set of non negative integers and a target value, find if there exists a subset in the given set whose sum is target. Solution 1. Enumerate all 阅读全文
摘要:
Given an array, write a program to generate a random permuation of array elements. This question is also asked as "shuffle a deck of cards" or "random 阅读全文
摘要:
Given a binary tree, find the maximum depth or height of this tree. Solution 1. In order traversal to count the maximum depth 1 import java.util.Linke 阅读全文
摘要:
Given a BST whose keys are integers. Find the inorder successor and predecessor of a given key. In case the given key is not found in the BST, return 阅读全文