摘要:
为何不像76. Minimum Window Substring用数组来匹配, 是因为双指针是根据字符串的顺序遍历的, 而数组的话没有顺序.如 For example,S = "ADOBECODEBANC"T = "ABC" Minimum window is "BANC". 并不是非得ABC的顺序 阅读全文
摘要:
https://leetcode.com/problems/count-complete-tree-nodes/#/description http://www.cnblogs.com/EdwardLiu/p/5058570.html 递归树高法 复杂度 时间 O(N) 空间 O(1) 思路 完全二 阅读全文
摘要:
https://leetcode.com/problems/minimum-size-subarray-sum/#/solutions Since the given array contains only positive integers, the subarray sum can only i 阅读全文
摘要:
https://leetcode.com/problems/valid-perfect-square/#/solutions 数学问题常考虑是否越界, 用long? 阅读全文
摘要:
https://leetcode.com/problems/search-a-2d-matrix/#/solutions 考点只有一个:2D array 降维成 1D array 的 index trick. 阅读全文
摘要:
https://leetcode.com/submissions/detail/107115768/ http://www.cnblogs.com/EdwardLiu/p/3978972.html 画图分情况讨论: 根据1 增添之 The idea is that when rotating the 阅读全文
摘要:
http://www.cnblogs.com/EdwardLiu/p/6139796.html https://leetcode.com/problems/find-right-interval/#/solutions Solution 1: TreeMap, Time complexity: O( 阅读全文
摘要:
https://leetcode.com/submissions/detail/106777290/ http://www.cnblogs.com/EdwardLiu/p/3981176.html Linkedin: 直接比较就行, 不用compare 或用newton,比较短: 计算x2 = n的 阅读全文
摘要:
https://leetcode.com/submissions/detail/106698735/ 要求O(logN)的时间复杂度,想到用二分查找。如果中间元素大于其相邻后续元素,则中间元素左侧(包含该中间元素)必包含一个局部最大值。如果中间元素小于其相邻后续元素,则中间元素右侧必包含一个局部最大 阅读全文
摘要:
http://www.cnblogs.com/EdwardLiu/p/6197086.html https://leetcode.com/problems/heaters/#/description Binary Search My solution: Be careful in my binary 阅读全文