摘要: 1、如果用“.”作为分隔的话,必须是如下写法,String.split("\\."),这样才能正确的分隔开,不能用String.split("."); 2、如果用“|”作为分隔的话,必须是如下写法,String.split("\\|"),这样才能正确的分隔开,不能用String.split("|") 阅读全文
posted @ 2018-12-10 04:20 jasoncool1 阅读(152) 评论(0) 推荐(0) 编辑
摘要: handle overflow的情况 要是num == Integer.MAX_VALUE 直接return res 注意prev <= num 的时候 讨论才有意义 阅读全文
posted @ 2018-12-10 01:28 jasoncool1 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 只有edit distance == 1的才能返回true 最后一个return返回的事是否后面只有一个char 因为前面都一样 只有是有的情况下 才能返回true 阅读全文
posted @ 2018-12-10 00:36 jasoncool1 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 TreeNode newRoot; 3 TreeNode prev; 4 public TreeNode upsideDownBinaryTree(TreeNode root) { 5 if(root == null) return root; 6 helper(root); 7 ... 阅读全文
posted @ 2018-12-09 12:57 jasoncool1 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 用curString去记录前面的String的结果 阅读全文
posted @ 2018-12-09 08:00 jasoncool1 阅读(157) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/gas-station/discuss/42591/java-greedy-solution 阅读全文
posted @ 2018-12-06 12:13 jasoncool1 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 List res = new ArrayList(); 3 public List addOperators(String num, int target) { 4 if(num.length() == 0) return res; 5 backtrack(num, target, "", 0, ... 阅读全文
posted @ 2018-11-27 02:21 jasoncool1 阅读(149) 评论(0) 推荐(0) 编辑
摘要: set中没有c2的时候再去增加c2的degree 不然会出错 阅读全文
posted @ 2018-11-27 01:25 jasoncool1 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 每次remove一个( 或者 ) 看看整体valid吗 valid的话这个就是最小的remove数量 阅读全文
posted @ 2018-11-07 00:42 jasoncool1 阅读(168) 评论(0) 推荐(0) 编辑
摘要: map记录位置remove时候把最后一位跟要remove的交换 然后去掉最后一位 这样可以达到O(1) 阅读全文
posted @ 2018-11-03 09:26 jasoncool1 阅读(116) 评论(0) 推荐(0) 编辑