LeetCode Link 思路:按层剪掉 leaf nodes,当最终只剩一个或者两个 nodes,即为题解 可以使用 HashMap > map,这样就不用使用 inde...
LeetCode Link 思路:按层剪掉 leaf nodes,当最终只剩一个或者两个 nodes,即为题解 可以使用 HashMap > map,这样就不用使用 inde...
给定 array of integers, 返回个数多余 len/3 的 items要求: Linear Runtime, O(1) Space 思路:满足条件的 items...
给定一个 array,输出超出半数的 item 一题多解,各种思路,面试热点问题。From 花花酱, 题解思路如下: Solution 1: HashMap Runtime:...
LeetCode Link
LeetCode Link下面的 Solution 可以 optimize to O(1) space: leftToRight as res rightToLeft sto...
LeetCode Solution 1 Solution 2 with parent reference Solution 3 Find Two path and compa...
Course Schedulehttps://www.jianshu.com/p/341a09e86930 Course Schedule IIhttps://www.jia...
Word Break:https://www.jianshu.com/p/c661daf51a01 Word Break IIhttps://www.jianshu.com/...
Given a set of distinct integers, nums, return all possible subsets (the power set). No...
Given an array of strings, group anagrams together. Example: Note: All inputs will be i...
思路: Two Pointers
题目分析: Move 会有以下几种情况:out of boarder => return -1hit self => return -1special case: 如果下一个...
题目链接:Fibonacci In mathematics, the Fibonacci numbers are the numbers in the following i...
LeetCode Link depth and height are properties of a node:The depth of a node is the numb...
LeetCode Link
这种 Wrapper 方式比较好理解题解思路,以及处理 Corner case。下面的题解思路同上面一致。 另一种类似写法:
303. Range Sum Query - Immutable
LeetCode Link 题解方式 DP
LeetCode Link Follow up: Extend to List of List List of iterators如果保持所有的 iterators,那么 n...