随笔分类 -  Marked

摘要: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-02-18 08:16 Razer.Lu 阅读(321) 评论(0) 推荐(0)
摘要:Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of ... 阅读全文
posted @ 2014-02-17 13:59 Razer.Lu 阅读(263) 评论(0) 推荐(0)
摘要:Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t... 阅读全文
posted @ 2014-02-17 13:34 Razer.Lu 阅读(249) 评论(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-02-17 02:55 Razer.Lu 阅读(173) 评论(0) 推荐(0)
摘要:Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 ... 阅读全文
posted @ 2014-02-17 01:29 Razer.Lu 阅读(208) 评论(0) 推荐(0)
摘要:Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution stil... 阅读全文
posted @ 2014-02-15 02:52 Razer.Lu 阅读(213) 评论(0) 推荐(0)
摘要:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree andsum =... 阅读全文
posted @ 2014-02-14 10:38 Razer.Lu 阅读(178) 评论(0) 推荐(0)
摘要:Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.后续遍历 根节点在最后一个元... 阅读全文
posted @ 2014-02-12 06:57 Razer.Lu 阅读(177) 评论(0) 推荐(0)
摘要:Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.ref:http://fish... 阅读全文
posted @ 2014-02-12 06:50 Razer.Lu 阅读(224) 评论(0) 推荐(0)
摘要:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.Ref:http://www.cnblogs.com/feiling/p/3267... 阅读全文
posted @ 2014-02-03 01:39 Razer.Lu 阅读(303) 评论(0) 推荐(0)
摘要:Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which rep... 阅读全文
posted @ 2014-02-01 09:19 Razer.Lu 阅读(163) 评论(0) 推荐(0)
摘要:Given two words (startandend), and a dictionary, find the length of shortest transformation sequence fromstarttoend, such that:Only one letter can be ... 阅读全文
posted @ 2014-01-26 16:50 Razer.Lu 阅读(229) 评论(0) 推荐(0)
摘要:Two pointerspublic class Solution { public ArrayList> threeSum(int[] num) { ArrayList> result = new ArrayList>(); Arrays.sort(num); ... 阅读全文
posted @ 2014-01-25 17:25 Razer.Lu 阅读(185) 评论(0) 推荐(0)