摘要: 熟悉了一下linkedlist的构造和处理 阅读全文
posted @ 2018-08-17 23:21 jasoncool1 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 要先sort之后 判断a.end b.start才能找出interval list可以用Collections.sort()进行排序 new Comparator<类型> 然后重写compare方法 返回数字就可以 阅读全文
posted @ 2018-08-17 05:20 jasoncool1 阅读(127) 评论(0) 推荐(0) 编辑
摘要: DFS把能遍历到的是1的都变成0,这样就能识别出一个岛。 阅读全文
posted @ 2018-08-17 03:01 jasoncool1 阅读(175) 评论(0) 推荐(0) 编辑
摘要: Queue使用时要尽量避免Collection的add()和remove()方法,而是要使用offer()来加入元素,使用poll()来获取并移出元素。它们的优点是通过返回值可以判断成功与否,add()和remove()方法在失败的时候会抛出异常。 如果要使用前端而不移出该元素,使用element( 阅读全文
posted @ 2018-08-17 00:57 jasoncool1 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 初次了解DFS实际代码 注意事项已标注 阅读全文
posted @ 2018-08-16 23:51 jasoncool1 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 1 //Old 2 class Solution { 3 public boolean canJump(int[] nums) { 4 int n = nums.length; 5 if(n == 0) return false; 6 if(n == 1) return true; 7 if(nums[0] =... 阅读全文
posted @ 2018-08-16 11:37 jasoncool1 阅读(243) 评论(0) 推荐(0) 编辑
摘要: 没啥特别的 阅读全文
posted @ 2018-08-16 10:20 jasoncool1 阅读(125) 评论(0) 推荐(0) 编辑
摘要: Java String to int1.int a = Integer.parseInt(str);2.int b = Integer.valueOf(str).intValue(); Char to intint c1 = Character.getNumericValue(i); 考虑0的情况 阅读全文
posted @ 2018-08-16 09:21 jasoncool1 阅读(295) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public int rob(int[] nums) { 3 int n = nums.length; 4 int[] res = new int[n]; 5 if(n == 0) return 0; 6 if(n == 1) return nums[0]; 7 ... 阅读全文
posted @ 2018-08-08 00:04 jasoncool1 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public int rob(int[] nums) { 3 int n = nums.length; 4 int[] res = new int[n + 1]; 5 if(n == 0) return 0; 6 if(n == 1) return nums[0]; 7... 阅读全文
posted @ 2018-08-07 23:34 jasoncool1 阅读(107) 评论(0) 推荐(0) 编辑