摘要:
Trapping Rain Water2014.2.10 03:25Givennnon-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.For example,Given[0,1,0,2,1,0,1,3,2,1,2,1], return6.The above elevation map is represented by array [0,1,0,2,1,0,1,3,2 阅读全文
posted @ 2014-02-10 03:38
zhuli19901106
阅读(279)
评论(0)
推荐(0)
摘要:
Unique Binary Search Trees II2014.2.10 02:54Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your program should return all 5 unique BST's shown below. 1 3 3 2 1 \ / / / \ \ 3 2 ... 阅读全文
posted @ 2014-02-10 03:16
zhuli19901106
阅读(173)
评论(0)
推荐(0)
摘要:
Text Justification2014.2.10 02:42Given an array of words and a lengthL, format the text such that each line has exactlyLcharacters and is fully (left and right) justified.You should pack your words in a greedy approach; that is, pack as many words as you can in each line. Pad extra spaces' ' 阅读全文
posted @ 2014-02-10 02:51
zhuli19901106
阅读(368)
评论(0)
推荐(0)
摘要:
String to Integer (atoi)2014.2.10 02:23Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases.Notes:It is intended for this problem to be specified vaguely (i 阅读全文
posted @ 2014-02-10 02:37
zhuli19901106
阅读(205)
评论(0)
推荐(0)
摘要:
Longest Palindromic Substring2014.2.10 00:57Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest palindromic substring.Solution1: My first solution to this problem is the brute-force version, with O(n^2) . 阅读全文
posted @ 2014-02-10 01:36
zhuli19901106
阅读(327)
评论(0)
推荐(0)


浙公网安备 33010602011771号