摘要:
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n. Example Given n = 3, your program should return all 5 u 阅读全文
摘要:
Given n, how many structurally unique BSTs (binary search trees) that store values 1...n? Example Given n = 3, there are a total of 5 unique BST's. 1 阅读全文
摘要:
Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two n 阅读全文
摘要:
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. 阅读全文
摘要:
Given an directed graph, a topological order of the graph nodes is defined as follow: For each directed edge A -> B in graph, A must before B in the o 阅读全文
摘要:
Given two array of integers(the first array is array A, the second array is array B), now we are going to find a element in array A which is A[i], and 阅读全文
摘要:
Given a linked list and two values v1 and v2. Swap the two nodes in the linked list with values v1 and v2. It's guaranteed there is no duplicate value 阅读全文
摘要:
Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'. A region is captured by flipping all 'O''s into 'X''s in that surround 阅读全文
摘要:
There is a fence with n posts, each post can be painted with one of the kcolors.You have to paint all the posts such that no more than two adjacent fe 阅读全文
摘要:
Write a program to find the nth super ugly number. Super ugly numbers are positive numbers whose all prime factors are in the given prime list primes 阅读全文
摘要:
Ugly number is a number that only have factors 2, 3 and 5. Design an algorithm to find the nth ugly number. The first 10 ugly numbers are 1, 2, 3, 4, 阅读全文
摘要:
Write a program to check whether a given number is an ugly number`. Ugly numbers are positive numbers whose prime factors only include 2,3, 5. For exa 阅读全文
摘要:
Given a list of numbers that may has duplicate numbers, return all possible subsets Notice Each element in a subset must be in non-descending order. T 阅读全文
摘要:
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 阅读全文