摘要: 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 阅读全文
posted @ 2016-04-07 12:48 哥布林工程师 阅读(96) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2016-04-07 12:34 哥布林工程师 阅读(92) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2016-04-07 12:12 哥布林工程师 阅读(94) 评论(0) 推荐(0) 编辑
摘要: 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. 阅读全文
posted @ 2016-04-07 12:08 哥布林工程师 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2016-04-07 11:57 哥布林工程师 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2016-04-07 08:43 哥布林工程师 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2016-04-07 07:53 哥布林工程师 阅读(251) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2016-04-07 07:34 哥布林工程师 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2016-04-07 07:08 哥布林工程师 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2016-04-07 06:57 哥布林工程师 阅读(200) 评论(0) 推荐(0) 编辑