2019年3月28日
摘要: Another Two Sum java class Solution { public int subarraysDivByK(int[] A, int K) { int[] sum = new int[A.length + 1]; for (int i = 0; i c = new HashMa 阅读全文
posted @ 2019-03-28 23:06 王 帅 阅读(135) 评论(0) 推荐(0) 编辑
摘要: technically, no different with two sum 阅读全文
posted @ 2019-03-28 23:05 王 帅 阅读(108) 评论(0) 推荐(0) 编辑
摘要: This remains me of some 'subarray count' type problems….. 阅读全文
posted @ 2019-03-28 23:03 王 帅 阅读(129) 评论(0) 推荐(0) 编辑
摘要: Prefix product or two pointer can both solve this problem. But don't forget to take a look at the note 阅读全文
posted @ 2019-03-28 23:01 王 帅 阅读(105) 评论(0) 推荐(0) 编辑
摘要: prefix sum k = 0 is a corner case, in which case just save , not And every time, record the leftmost index of a key.(greedy) 阅读全文
posted @ 2019-03-28 22:52 王 帅 阅读(105) 评论(0) 推荐(0) 编辑
摘要: Use prefix product(sum? actually much the same). 阅读全文
posted @ 2019-03-28 22:44 王 帅 阅读(77) 评论(0) 推荐(0) 编辑
摘要: using sliding window And try to Using prefix sum method, the rightmost index with value = s ? 1: N + 1; for (int i = 1; i target) { ret = Math.min(ret 阅读全文
posted @ 2019-03-28 22:42 王 帅 阅读(82) 评论(0) 推荐(0) 编辑
摘要: O(N) space and O(M N) time solution, where M, N is A's row number and column number java class Solution { public int minFallingPathSum(int[][] A) { in 阅读全文
posted @ 2019-03-28 07:46 王 帅 阅读(84) 评论(0) 推荐(0) 编辑
摘要: Divide and conquer I'm not so good at this kind of problem, so I just checked the solution page. 阅读全文
posted @ 2019-03-28 07:45 王 帅 阅读(136) 评论(0) 推荐(0) 编辑
摘要: ```java class RecentCounter { Queue q; public RecentCounter() { q = new LinkedList(); } public int ping(int t) { int threshold = t 3000; while (q.size 阅读全文
posted @ 2019-03-28 07:44 王 帅 阅读(108) 评论(0) 推荐(0) 编辑