上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 36 下一页
摘要: 1. Use TreeMap since it's keySet is sorted. 阅读全文
posted @ 2016-07-05 15:03 keepshuatishuati 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 1. This binary search is find the insertion position. Since it starts from end of array. So it must be greater and equal to mid number. The merge sort 阅读全文
posted @ 2016-07-05 14:51 keepshuatishuati 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 1. Add " " to ensure the comparision works. Or add a condition that result.length() > 0 2. character counting decrease happens before check it has bee 阅读全文
posted @ 2016-07-05 07:13 keepshuatishuati 阅读(107) 评论(0) 推荐(0) 编辑
摘要: Basic idea: 1. starting from each element expanding to all map. Find a 0, add one to reach, and level traversal to. 2. Go through each element again. 阅读全文
posted @ 2016-07-05 07:03 keepshuatishuati 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 1. Do not forget to left shift the number. 阅读全文
posted @ 2016-07-05 06:20 keepshuatishuati 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 1. Do not need to check boundary case since the helper function can add "" into result. 2. Do not forget to add that character if not counting into ab 阅读全文
posted @ 2016-07-05 06:12 keepshuatishuati 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 1. When divide k into two parts, it could be 0 for the any part. So i <= nums1.length. 阅读全文
posted @ 2016-07-05 05:59 keepshuatishuati 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 1 public class Solution { 2 private int[] parent; 3 public int countComponents(int n, int[][] edges) { 4 if (edges.length == 0) { 5 return n; 6 } 7 ... 阅读全文
posted @ 2016-07-02 07:06 keepshuatishuati 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 1. Use backward arrangement in case of [4, 5, 5, 6]. 阅读全文
posted @ 2016-07-02 06:56 keepshuatishuati 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 1 public class Solution { 2 public boolean isPowerOfThree(int n) { 3 while (n > 1) { 4 if (n % 3 != 0) { 5 return false; 6 } 7 n... 阅读全文
posted @ 2016-07-02 05:58 keepshuatishuati 阅读(116) 评论(0) 推荐(0) 编辑
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 36 下一页