摘要: class TrieNode { // Initialize your data structure here. TrieNode[] child; boolean isWord; public TrieNode() { child = new TrieNode... 阅读全文
posted @ 2015-12-06 12:36 Weizheng_Love_Coding 阅读(119) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public List wordBreak(String s, Set wordDict) { return helper(s, wordDict, new HashMap>()); } public List ... 阅读全文
posted @ 2015-12-06 12:19 Weizheng_Love_Coding 阅读(129) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public String longestPalindrome(String s) { int length = s.length(); String result = ""; for (int i = ... 阅读全文
posted @ 2015-12-06 10:22 Weizheng_Love_Coding 阅读(140) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public String longestPalindrome(String s) { int length = s.length(); String result = ""; for (int i = ... 阅读全文
posted @ 2015-12-06 09:47 Weizheng_Love_Coding 阅读(117) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public String simplifyPath(String path) { String[] strs = path.split("/"); Stack stack = new Stack(); ... 阅读全文
posted @ 2015-12-06 08:05 Weizheng_Love_Coding 阅读(105) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public int calculate(String s) { Stack stack = new Stack(); s = s.replace(" ", ""); int length = s.len... 阅读全文
posted @ 2015-12-06 07:35 Weizheng_Love_Coding 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 在网上看了一个超级精妙的解法public class Solution { public String multiply(String num1, String num2) { int length1 = num1.length(); int length2 = n... 阅读全文
posted @ 2015-12-06 06:31 Weizheng_Love_Coding 阅读(140) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public TreeNode buildTree(int[] preorder, int[] inorder) { int length = preorder.length; if (length == 0) { ... 阅读全文
posted @ 2015-12-06 05:19 Weizheng_Love_Coding 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 用了treemap来维护左右关系,其实也可以不用,记录一个min的index就好。public class Solution { public List> verticalOrder(TreeNode root) { List> result = new ArrayList>()... 阅读全文
posted @ 2015-12-06 03:04 Weizheng_Love_Coding 阅读(308) 评论(0) 推荐(0) 编辑