上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 36 下一页
摘要: 1 public class MedianFinder { 2 private PriorityQueue maxQueue; 3 private PriorityQueue minQueue; 4 5 public MedianFinder() { 6 maxQueue = new PriorityQueue(Collections... 阅读全文
posted @ 2016-07-06 07:40 keepshuatishuati 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 1 /** 2 * Definition for a binary tree node. 3 * public class TreeNode { 4 * int val; 5 * TreeNode left; 6 * TreeNode right; 7 * TreeNode(int x) { val = x; } 8 * } 9 ... 阅读全文
posted @ 2016-07-06 07:33 keepshuatishuati 阅读(139) 评论(0) 推荐(0) 编辑
摘要: Maximum value get should be count increase. Otherwise, it already breaks the consequences. 阅读全文
posted @ 2016-07-06 07:24 keepshuatishuati 阅读(120) 评论(0) 推荐(0) 编辑
摘要: Binary search: 1. The bound is defined to search "0" or "1". When search 0 - x, we want to get the most left "1". So k < right mean there is a one, j 阅读全文
posted @ 2016-07-06 07:13 keepshuatishuati 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 1 public class Solution { 2 private int count; 3 private int[] parent; 4 public List numIslands2(int m, int n, int[][] positions) { 5 List result = new ArrayList(); 6 ... 阅读全文
posted @ 2016-07-06 06:18 keepshuatishuati 阅读(129) 评论(0) 推荐(0) 编辑
摘要: Binary index tree: https://www.topcoder.com/community/data-science/data-science-tutorials/binary-indexed-trees/ 阅读全文
posted @ 2016-07-06 06:00 keepshuatishuati 阅读(194) 评论(0) 推荐(0) 编辑
摘要: lastSell = sell is after buy max. So the buy price is compared with sell[i-2]. Current sell is sell[i-1]. 阅读全文
posted @ 2016-07-06 05:43 keepshuatishuati 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 1. Check boundary case that when n == 1. There is only one node (0) 2. Set can access by iterator. 阅读全文
posted @ 2016-07-06 05:30 keepshuatishuati 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 1. Make final balloon as the position i. 2. try to optimize the solution from (left , i - 1) to (i + 1, right). 3. Since it garantee to cover i positi 阅读全文
posted @ 2016-07-06 05:15 keepshuatishuati 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 1. data initialization : index = 0. 2. use a set to deduplicate the numbers. 阅读全文
posted @ 2016-07-05 15:14 keepshuatishuati 阅读(109) 评论(0) 推荐(0) 编辑
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 36 下一页