01 2015 档案
[Leetcode][JAVA] Insert Interval
摘要:Given a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially... 阅读全文
posted @ 2015-01-26 10:00 metalx 阅读(212) 评论(0) 推荐(0)
[Leetcode][JAVA] Minimum Window Substring
摘要:Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S="ADOBECODEBA... 阅读全文
posted @ 2015-01-21 05:00 metalx 阅读(260) 评论(0) 推荐(0)
[Leetcode][JAVA] Interleaving String
摘要:Givens1,s2,s3, find whethers3is formed by the interleaving ofs1ands2.For example,Given:s1="aabcc",s2="dbbca",Whens3="aadbbcbcac", return true.Whens3="... 阅读全文
posted @ 2015-01-13 05:22 metalx 阅读(204) 评论(0) 推荐(0)
[Leetcode][JAVA] Recover Binary Search Tree (Morris Inorder Traversal)
摘要:Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is ... 阅读全文
posted @ 2015-01-13 03:58 metalx 阅读(291) 评论(0) 推荐(0)
[Leetcode][JAVA] Flatten Binary Tree to Linked List
摘要:Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t... 阅读全文
posted @ 2015-01-09 07:17 metalx 阅读(216) 评论(0) 推荐(0)
[Leetcode][JAVA] Distinct Subsequences
摘要:Given a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is formed from the orig... 阅读全文
posted @ 2015-01-09 01:20 metalx 阅读(244) 评论(0) 推荐(0)
[Leetcode][JAVA] Populating Next Right Pointers in Each Node II
摘要: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 @ 2015-01-08 06:37 metalx 阅读(215) 评论(0) 推荐(0)
[Leetcode][JAVA] Pascal's Triangle I, II
摘要:Pascal's Triangle:GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3... 阅读全文
posted @ 2015-01-08 03:53 metalx 阅读(207) 评论(0) 推荐(0)
[Leetcode][JAVA] Triangled
摘要:TriangleGiven 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... 阅读全文
posted @ 2015-01-07 22:17 metalx 阅读(287) 评论(0) 推荐(0)
[Leetcode][JAVA] Best Time to Buy and Sell Stock I, II, III
摘要:Best Time to Buy and Sell StockSay you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to co... 阅读全文
posted @ 2015-01-06 22:28 metalx 阅读(221) 评论(0) 推荐(0)