摘要:
class TrieNode { // Initialize your data structure here. TrieNode[] child; boolean isWord; public TrieNode() { child = new TrieNode... 阅读全文
摘要:
public class Solution { public List wordBreak(String s, Set wordDict) { return helper(s, wordDict, new HashMap>()); } public List ... 阅读全文
摘要:
public class Solution { public String longestPalindrome(String s) { int length = s.length(); String result = ""; for (int i = ... 阅读全文
摘要:
public class Solution { public String longestPalindrome(String s) { int length = s.length(); String result = ""; for (int i = ... 阅读全文
摘要:
public class Solution { public String simplifyPath(String path) { String[] strs = path.split("/"); Stack stack = new Stack(); ... 阅读全文
摘要:
public class Solution { public int calculate(String s) { Stack stack = new Stack(); s = s.replace(" ", ""); int length = s.len... 阅读全文
摘要:
在网上看了一个超级精妙的解法public class Solution { public String multiply(String num1, String num2) { int length1 = num1.length(); int length2 = n... 阅读全文
摘要:
public class Solution { public TreeNode buildTree(int[] preorder, int[] inorder) { int length = preorder.length; if (length == 0) { ... 阅读全文
摘要:
用了treemap来维护左右关系,其实也可以不用,记录一个min的index就好。public class Solution { public List> verticalOrder(TreeNode root) { List> result = new ArrayList>()... 阅读全文