LeetCode Link 思路:按層剪掉 leaf nodes,當(dāng)最終只剩一個或者兩個 nodes,即為題解 可以使用 HashMap > map,這樣就不用使用 inde...
LeetCode Link 思路:按層剪掉 leaf nodes,當(dāng)最終只剩一個或者兩個 nodes,即為題解 可以使用 HashMap > map,這樣就不用使用 inde...
給定 array of integers, 返回個數(shù)多余 len/3 的 items要求: Linear Runtime, O(1) Space 思路:滿足條件的 items...
給定一個 array,輸出超出半數(shù)的 item 一題多解,各種思路,面試熱點問題。From 花花醬, 題解思路如下: Solution 1: HashMap Runtime:...
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 Schedulehttp://www.itdecent.cn/p/341a09e86930 Course Schedule IIhttps://www.jia...
Word Break:http://www.itdecent.cn/p/c661daf51a01 Word Break IIhttp://www.itdecent.cn/...
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...
題目分析: 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...
這種 Wrapper 方式比較好理解題解思路,以及處理 Corner case。下面的題解思路同上面一致。 另一種類似寫法:
LeetCode Link Follow up: Extend to List of List List of iterators如果保持所有的 iterators,那么 n...