上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 22 下一页
摘要: https://leetcode.com/problems/intersection-of-two-arrays-ii/discuss/82450/Java-O(m+n)-using-Hash-and-List 阅读全文
posted @ 2018-09-27 12:17 jasoncool1 阅读(96) 评论(0) 推荐(0) 编辑
摘要: str.trim.split(" +") 然后用StringBuilderhttps://leetcode.com/problems/reverse-words-in-a-string/discuss/161008/6-line-Java-answer 阅读全文
posted @ 2018-09-27 10:37 jasoncool1 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 可以用priorityqueuePriorityQueue<Integer> pq = new PriorityQueue<>(); https://leetcode.com/problems/third-maximum-number/discuss/90190/Java-PriorityQueue 阅读全文
posted @ 2018-09-27 10:06 jasoncool1 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public String longestCommonPrefix(String[] strs) { 3 if(strs.length == 0) return ""; 4 StringBuilder sb = new StringBuilder(""); 5 for(int i = 0;... 阅读全文
posted @ 2018-09-26 10:29 jasoncool1 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public boolean isPalindrome(int x) { 3 if(x < 0) return false; 4 String str = "" + x; 5 StringBuilder sb = new StringBuilder(str); 6 return sb... 阅读全文
posted @ 2018-09-26 09:39 jasoncool1 阅读(80) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public int reverse(int x) { 3 long x2 = (long)x; 4 if(x == 0) return 0; 5 if(x2 Integer.MAX_VALUE) { 22 return 0; 23 ... 阅读全文
posted @ 2018-09-26 04:21 jasoncool1 阅读(96) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 List> res = new ArrayList(); 3 public List> partition(String s) { 4 if(s.length() == 0) return res; 5 dfs(s, 0, new ArrayList() ); 6 return ... 阅读全文
posted @ 2018-09-23 23:58 jasoncool1 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 不知道说啥好,从边缘是O的开始标记不可能变的点,这样时间复杂度只有O(mn) 阅读全文
posted @ 2018-09-23 23:29 jasoncool1 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 1 //New 2 class Solution { 3 public int sumNumbers(TreeNode root) { 4 if(root == null) return 0; 5 return dfs(root, 0); 6 7 } 8 9 public int dfs(Tre... 阅读全文
posted @ 2018-09-23 11:29 jasoncool1 阅读(102) 评论(0) 推荐(0) 编辑
摘要: Set会快很多替换各个位置的字符 在wordDict里面判断存不存在类似BFShttps://blog.csdn.net/u014532901/article/details/78820124 阅读全文
posted @ 2018-09-23 10:58 jasoncool1 阅读(155) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 22 下一页