摘要: http://www.programcreek.com/2011/10/java-class-instance-initializers/ 阅读全文
posted @ 2014-05-03 06:05 Razer.Lu 阅读(161) 评论(0) 推荐(0) 编辑
摘要: http://www.cnblogs.com/shawnhue/archive/2013/06/05/leetcode_126.htmlhttp://fisherlei.blogspot.com/2013/02/leetcode-word-ladder-ii-solution.htmlhttp://blog.csdn.net/niaokedaoren/article/details/8884938 1 class Node { 2 int no; 3 String val; 4 LinkedList prev; 5 6 Node(int no,... 阅读全文
posted @ 2014-03-07 02:55 Razer.Lu 阅读(260) 评论(0) 推荐(0) 编辑
摘要: TreeBinary Tree Preorder TraversalBinary Tree Inorder TraversalBinary Tree Postorder TraversalBinary Tree Level Order TraversalBinary Tree Level Order Traversal IIBinary Tree Zigzag Level Order TraversalMaximum Depth of Binary TreeMinimum Depth of Binary TreePath SumPath Sum IIBinary Tree Maximum Pa 阅读全文
posted @ 2014-02-21 16:10 Razer.Lu 阅读(551) 评论(0) 推荐(0) 编辑
摘要: Given an integern, generate a square matrix filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should return the following matrix:[ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7, 6, 5 ]]生成的过程为 (1) 横向生成 1,2 (2) 纵向生成 3,4 (3) 横向生成 5,6 (4) 纵向生成 7,8 (5) 生成 9public class ... 阅读全文
posted @ 2014-02-20 16:10 Razer.Lu 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 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 original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (ie,"ACE" 阅读全文
posted @ 2014-02-20 16:06 Razer.Lu 阅读(188) 评论(0) 推荐(0) 编辑
摘要: Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Ref:http://fisherlei.blogspot.com/20... 阅读全文
posted @ 2014-02-20 15:24 Razer.Lu 阅读(228) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?Ref :http://fisherlei.blogspot.com/2013/11/leetcode-single-number-ii-solution.html[Thoughts] 阅读全文
posted @ 2014-02-20 14:45 Razer.Lu 阅读(196) 评论(0) 推荐(0) 编辑
摘要: Given an absolute path for a file (Unix-style), simplify it.For example,path="/home/", =>"/home"path="/a/./b/../../c/", =>"/c"click to show corner cases.Corner Cases:Did you consider the case wherepath="/../"?In this case, you should return&quo 阅读全文
posted @ 2014-02-20 13:57 Razer.Lu 阅读(247) 评论(0) 推荐(0) 编辑
摘要: Evaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another express... 阅读全文
posted @ 2014-02-20 13:42 Razer.Lu 阅读(187) 评论(0) 推荐(0) 编辑
摘要: Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.思路: 从 points[] 中依次取出一个点,然后依次和后面一个点组成一条直线。 y = ax+b;然后... 阅读全文
posted @ 2014-02-20 10:27 Razer.Lu 阅读(220) 评论(0) 推荐(0) 编辑