09 2014 档案

摘要:Givennnon-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histog... 阅读全文
posted @ 2014-09-07 16:53 山是水的故事 阅读(261) 评论(0) 推荐(0)
摘要:Container With Most WaterTotal Accepted:15862Total Submissions:50802My SubmissionsGivennnon-negative integersa1,a2, ...,an, where each represents a po... 阅读全文
posted @ 2014-09-07 15:22 山是水的故事 阅读(129) 评论(0) 推荐(0)
摘要:There areNgas stations along a circular route, where the amount of gas at stationiisgas[i].You have a car with an unlimited gas tank and it costscost[... 阅读全文
posted @ 2014-09-06 23:52 山是水的故事 阅读(318) 评论(0) 推荐(0)
摘要:递归算法bool valid(vector &res, int r) { int nCol = res.size(); for(int i=0;i res, int &nCount) { if (l == n) { ... 阅读全文
posted @ 2014-09-06 22:27 山是水的故事 阅读(144) 评论(0) 推荐(0)
摘要:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the fol... 阅读全文
posted @ 2014-09-06 16:27 山是水的故事 阅读(189) 评论(0) 推荐(0)
摘要:Given an unsorted integer array, find the first missing positive integer. For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2.Your algorithm sh... 阅读全文
posted @ 2014-09-05 16:38 山是水的故事 阅读(119) 评论(0) 推荐(0)
摘要:Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each numb... 阅读全文
posted @ 2014-09-05 15:48 山是水的故事 阅读(107) 评论(0) 推荐(0)
摘要:bool helper(TreeNode *pA, TreeNode *pB) { if (!pA && !pB) return true; if (!pA || !pB) return false; // only one has node in a tree and... 阅读全文
posted @ 2014-09-04 22:06 山是水的故事 阅读(231) 评论(0) 推荐(0)
摘要:Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))... 阅读全文
posted @ 2014-09-04 21:27 山是水的故事 阅读(258) 评论(0) 推荐(0)
摘要:Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your program should return all 5 uni... 阅读全文
posted @ 2014-09-04 17:45 山是水的故事 阅读(322) 评论(0) 推荐(0)
摘要:Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4, 200, 1, 3, 2],The longest ... 阅读全文
posted @ 2014-09-04 15:15 山是水的故事 阅读(629) 评论(0) 推荐(0)
摘要:The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1is read off as"one 1"or11.11is read off as"tw... 阅读全文
posted @ 2014-09-04 14:14 山是水的故事 阅读(464) 评论(0) 推荐(0)