摘要:
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
阅读(156)
评论(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
阅读(145)
评论(0)
推荐(0)
摘要:
Maximum value get should be count increase. Otherwise, it already breaks the consequences. 阅读全文
posted @ 2016-07-06 07:24
keepshuatishuati
阅读(127)
评论(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
阅读(153)
评论(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
阅读(132)
评论(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
阅读(199)
评论(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
阅读(197)
评论(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
阅读(148)
评论(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
阅读(146)
评论(0)
推荐(0)
浙公网安备 33010602011771号