上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 22 下一页
摘要: 1 class Solution { 2 public boolean isNStraightHand(int[] hand, int W) { 3 if(W == 1) return true; 4 Arrays.sort(hand); 5 int i = 0, j = 0; 6 while(i < hand.... 阅读全文
posted @ 2018-10-18 14:17 jasoncool1 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public boolean isIsomorphic(String s, String t) { 3 if(s.length() != t.length()) return false; 4 int[] record1 = new int[200]; 5 int[] record2 = ... 阅读全文
posted @ 2018-10-18 13:29 jasoncool1 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 1 //从右往左 先排序一下 然后右到左进行替换 这样替换位置之前的index不会变 2 //注意一下Comparator的写法 3 class Solution { 4 public String findReplaceString(String S, int[] indexes, String[] sources, String[] targets) { 5 ... 阅读全文
posted @ 2018-10-17 12:18 jasoncool1 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 1 //自己简化了 100% 2 class Solution { 3 public String getHint(String secret, String guess) { 4 int bull = 0; 5 int cow = 0; 6 char[] arr1 = secret.toCharArray(); 7 ... 阅读全文
posted @ 2018-10-17 09:23 jasoncool1 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 找substring存在不存在可以直接用indexOf() 或者contains() 不用一个一个比 边界情况是 c abc a 这样子 b.length()/a.length() == 1 所以要+2 阅读全文
posted @ 2018-10-17 03:42 jasoncool1 阅读(82) 评论(0) 推荐(0) 编辑
摘要: 跟字典序那道题一样 找出下一个 大于MAX_VALUE或者相同就return-1 阅读全文
posted @ 2018-10-09 20:28 jasoncool1 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 这个比较简单 https://leetcode.com/problems/trim-a-binary-search-tree/discuss/107000/Java-solution-6-liner 阅读全文
posted @ 2018-10-09 13:00 jasoncool1 阅读(158) 评论(0) 推荐(0) 编辑
摘要: common sense 直接sort 然后找citations > len-i 可以直接用一个bucket记录 然后大于N的全部记录在N上 因为hindex不可能大于N https://leetcode.com/problems/h-index/discuss/70768/Java-bucket- 阅读全文
posted @ 2018-10-09 11:42 jasoncool1 阅读(92) 评论(0) 推荐(0) 编辑
摘要: 把一行能达到的都遍历 visited为true 跟树的那个连接表一样 阅读全文
posted @ 2018-10-09 11:24 jasoncool1 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 只要算总共有多少5就可以 阅读全文
posted @ 2018-10-08 11:41 jasoncool1 阅读(60) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 22 下一页