來源:Github
編輯:元子
LeetCode是一個美國的在線編程網站,收集了各個大廠的筆試面試題,對找工作的畢業生和開發者來說,非常有價值。不過LeetCode上面的題目很多都是考察應聘者對基礎知識的應用,適合進行練習編程基礎或者準備面試。
很多求職者都會在LeetCode刷上一遍,面試官也喜歡在上面挑選各類題目。今天新智元給大家推薦的這個GitHub項目,是Repo主自己刷題的心路歷程,並給出了解題參考。該項目目前分為四個部分:
第一個部分是 leetcode 經典題目的解析,包括思路,關鍵點和具體的代碼實現
第二部分是對於數據結構與算法的總結
第三部分是 anki 卡片, 將 leetcode 題目按照一定的方式記錄在 anki 中,方便大家記憶
第四部分是計劃, 這裡會記錄將來要加入到以上三個部分內容
最近添加的部分, 前面會有 🆕 標註;最近更新的部分,前面會有 🖊 標註;將來會在這裡更新anki卡片。
leetcode官方帳號在知乎上給出的一個《網際網路公司最常見的面試算法題有哪些?》的答案,原文地址:
https://www.zhihu.com/question/24964987/answer/586425979
一張網際網路公司面試中經常考察的問題類型總結的思維導圖,我們可以結合圖片中的信息分析一下。
其中算法,主要是以下幾種:
數據結構,主要有如下幾種:
數組與鍊表:單 / 雙向鍊表
棧與隊列
哈希表
堆:最大堆 / 最小堆
樹與圖:最近公共祖先、併查集
字符串:前綴樹(字典樹) / 後綴樹
42.trapping-rain-water-1(雨水收集問題):
瀏覽器中的棧:
回溯法解題:
875. koko-eating-bananas:
簡單難度
🖊 20. Valid Parentheses:
https://github.com/azl397985856/leetcode/blob/master/problems/20.validParentheses.md
26.remove-duplicates-from-sorted-array:
https://github.com/azl397985856/leetcode/blob/master/problems/26.remove-duplicates-from-sorted-array.md
🆕 88.merge-sorted-array:
https://github.com/azl397985856/leetcode/blob/master/problems/88.merge-sorted-array.md
136.single-number:
https://github.com/azl397985856/leetcode/blob/master/problems/136.single-number.md
167.two-sum-ii-input-array-is-sorted:
https://github.com/azl397985856/leetcode/blob/master/problems/167.two-sum-ii-input-array-is-sorted.md
🆕 169.majority-element:
https://github.com/azl397985856/leetcode/blob/master/problems/169.majority-element.md
190.reverse-bits:
https://github.com/azl397985856/leetcode/blob/master/problems/190.reverse-bits.md
191.number-of-1-bits:
https://github.com/azl397985856/leetcode/blob/master/problems/191.number-of-1-bits.md
203.remove-linked-list-elements:
https://github.com/azl397985856/leetcode/blob/master/problems/203.remove-linked-list-elements.md
206.reverse-linked-list:
https://github.com/azl397985856/leetcode/blob/master/problems/206.reverse-linked-list.md
219.contains-duplicate-ii:
https://github.com/azl397985856/leetcode/blob/master/problems/219.contains-duplicate-ii.md
226.invert-binary-tree:
https://github.com/azl397985856/leetcode/blob/master/problems/226.invert-binary-tree.md
283.move-zeroes:
https://github.com/azl397985856/leetcode/blob/master/problems/283.move-zeroes.md
349.intersection-of-two-arrays:
https://github.com/azl397985856/leetcode/blob/master/problems/349.intersection-of-two-arrays.md
中等難度
2. Add Two Numbers:
https://github.com/azl397985856/leetcode/blob/master/problems/2.addTwoNumbers.md
3. Longest Substring Without Repeating Characters:
https://github.com/azl397985856/leetcode/blob/master/problems/3.longestSubstringWithoutRepeatingCharacters.md
11.container-with-most-water:
https://github.com/azl397985856/leetcode/blob/master/problems/11.container-with-most-water.md
19. Remove Nth Node From End of List:
https://github.com/azl397985856/leetcode/blob/master/problems/19.removeNthNodeFromEndofList.md
24. Swap Nodes In Pairs:
https://github.com/azl397985856/leetcode/blob/master/problems/24.swapNodesInPairs.md
🆕 39.combination-sum:
https://github.com/azl397985856/leetcode/blob/master/problems/39.combination-sum.md
🆕 40.combination-sum-ii:
https://github.com/azl397985856/leetcode/blob/master/problems/40.combination-sum-ii.md
🆕 46.permutations:
https://github.com/azl397985856/leetcode/blob/master/problems/46.permutations.md
🆕 47.permutations-ii:
https://github.com/azl397985856/leetcode/blob/master/problems/47.permutations-ii.md
🆕 55.jump-game:
https://github.com/azl397985856/leetcode/blob/master/problems/55.jump-game.md
🆕 62.unique-paths:
https://github.com/azl397985856/leetcode/blob/master/problems/62.unique-paths.md
75.sort-colors:
https://github.com/azl397985856/leetcode/blob/master/problems/75.sort-colors.md
🆕 78.subsets:
https://github.com/azl397985856/leetcode/blob/master/problems/78.subsets.md
86.partition-list:
https://github.com/azl397985856/leetcode/blob/master/problems/86.partition-list.md
🆕 90.subsets-ii:
https://github.com/azl397985856/leetcode/blob/master/problems/90.subsets-ii.md
92.reverse-linked-list-ii:
https://github.com/azl397985856/leetcode/blob/master/problems/92.reverse-linked-list-ii.md
94.binary-tree-inorder-traversal:
https://github.com/azl397985856/leetcode/blob/master/problems/94.binary-tree-inorder-traversal.md
102.binary-tree-level-order-traversal:
https://github.com/azl397985856/leetcode/blob/master/problems/102.binary-tree-level-order-traversal.md
103.binary-tree-zigzag-level-order-traversal:
https://github.com/azl397985856/leetcode/blob/master/problems/103.binary-tree-zigzag-level-order-traversal.md
139.word-break:
https://github.com/azl397985856/leetcode/blob/master/problems/139.word-breakmd
144.binary-tree-preorder-traversal:
https://github.com/azl397985856/leetcode/blob/master/problems/144.binary-tree-preorder-traversal.md
🖊 150.evaluate-reverse-polish-notation:
https://github.com/azl397985856/leetcode/blob/master/problems/150.evaluate-reverse-polish-notation.md
🆕 152.maximum-product-subarray:
https://github.com/azl397985856/leetcode/blob/master/problems/152.maximum-product-subarray.md
199.binary-tree-right-side-view:
https://github.com/azl397985856/leetcode/blob/master/problems/199.binary-tree-right-side-view.md
201.bitwise-and-of-numbers-range:
https://github.com/azl397985856/leetcode/blob/master/problems/201.bitwise-and-of-numbers-range.md
🆕 208.implement-trie-prefix-tree:
https://github.com/azl397985856/leetcode/blob/master/problems/208.implement-trie-prefix-tree.md
🖊 209.minimum-size-subarray-sum:
https://github.com/azl397985856/leetcode/blob/master/problems/209.minimum-size-subarray-sum.md
🆕 236.lowest-common-ancestor-of-a-binary-tree:
https://github.com/azl397985856/leetcode/blob/master/problems/236.lowest-common-ancestor-of-a-binary-tree.md
🆕 238.product-of-array-except-self:
https://github.com/azl397985856/leetcode/blob/master/problems/238.product-of-array-except-self.md
240.search-a-2-d-matrix-ii:
https://github.com/azl397985856/leetcode/blob/master/problems/240.search-a-2-d-matrix-ii.md
🖊 279.perfect-squares:
https://github.com/azl397985856/leetcode/blob/master/problems/279.perfect-squares.md
322.coin-change:
https://github.com/azl397985856/leetcode/blob/master/problems/322.coin-change.md
🆕 334.increasing-triplet-subsequence:
https://github.com/azl397985856/leetcode/blob/master/problems/334.increasing-triplet-subsequence.md
328.odd-even-linked-list:
https://github.com/azl397985856/leetcode/blob/master/problems/328.odd-even-linked-list.md
416.partition-equal-subset-sum:
https://github.com/azl397985856/leetcode/blob/master/problems/416.partition-equal-subset-sum.md
445.add-two-numbers-ii:
https://github.com/azl397985856/leetcode/blob/master/problems/445.add-two-numbers-ii.md
518.coin-change-2:
https://github.com/azl397985856/leetcode/blob/master/problems/518.coin-change-2.md
875.koko-eating-bananas:
https://github.com/azl397985856/leetcode/blob/master/problems/875.koko-eating-bananas.md
877.stone-game:
https://github.com/azl397985856/leetcode/blob/master/problems/877.stone-game.md
887.super-egg-drop:
https://github.com/azl397985856/leetcode/blob/master/problems/887.super-egg-drop.md
900.rle-iterator:
https://github.com/azl397985856/leetcode/blob/master/problems/900.rle-iterator.md
困難難度
🆕 23.merge-k-sorted-lists
https://github.com/azl397985856/leetcode/blob/master/problems/23.merge-k-sorted-lists.md
🆕 42.trapping-rain-water
https://github.com/azl397985856/leetcode/blob/master/problems/42.trapping-rain-water.md
🆕 128.longest-consecutive-sequence
https://github.com/azl397985856/leetcode/blob/master/problems/128.longest-consecutive-sequence.md
145.binary-tree-postorder-traversal
https://github.com/azl397985856/leetcode/blob/master/problems/145.binary-tree-postorder-traversal.md
146.lru-cache
https://github.com/azl397985856/leetcode/blob/master/problems/146.lru-cache.md
🆕 239.sliding-window-maximum
https://github.com/azl397985856/leetcode/blob/master/problems/239.sliding-window-maximum.md
🆕 295.find-median-from-data-stream.md
https://github.com/azl397985856/leetcode/blob/master/problems/295.find-median-from-data-stream.md
301.remove-invalid-parentheses
https://github.com/azl397985856/leetcode/blob/master/problems/301.remove-invalid-parentheses.md
數據結構與算法的總結
🖊 數據結構:
https://github.com/azl397985856/leetcode/blob/master/thinkings/basic-data-structure.md(草稿)
🖊 二叉樹的遍歷:
https://github.com/azl397985856/leetcode/blob/master/thinkings/binary-tree-traversal.md
動態規劃:
https://github.com/azl397985856/leetcode/blob/master/thinkings/dynamic-programming.md
哈夫曼編碼和遊程編碼:
https://github.com/azl397985856/leetcode/blob/master/thinkings/run-length-encode-and-huffman-encode.md
布隆過濾器:
https://github.com/azl397985856/leetcode/blob/master/thinkings/bloom-filter.md
Anki主要分為兩個部分:一部分是關鍵點到題目的映射,另一部分是題目到思路,關鍵點,代碼的映射。
全部卡片都在:
https://github.com/azl397985856/leetcode/blob/master/assets/anki/leetcode.apkg
使用方法
anki - 文件 - 導入 - 下拉格式選擇「打包的 anki集合」,然後選中你下載好的文件,確定即可。更多關於anki使用方法的請查看:
https://apps.ankiweb.net/
目前已更新卡片一覽(僅列舉正面):
二分法解決問題的關鍵點是什麼,相關問題有哪些
如何用棧的特點來簡化操作, 涉及到的題目有哪些?
雙指針問題的思路以及相關題目有哪些?
滑動窗口問題的思路以及相關題目有哪些?
回溯法解題的思路以及相關題目有哪些?
494.target-sum:
https://github.com/azl397985856/leetcode/blob/master/todo/494.target-sum.js
609.find-duplicate-file-in-system:
https://github.com/azl397985856/leetcode/blob/master/todo/609.find-duplicate-file-in-system.js
10.regular-expression-matching:
https://github.com/azl397985856/leetcode/blob/master/todo/10.regular-expression-matching.js
365.water-and-jug-problem:
https://github.com/azl397985856/leetcode/blob/master/todo/365.water-and-jug-problem.js
anki 卡片 完善:
https://github.com/azl397985856/leetcode/blob/master/assets/anki
字符串類問題匯總:
https://github.com/azl397985856/leetcode/blob/master/todo/str/
參考連結:
https://github.com/azl397985856/leetcode
新智元春季招聘開啟,一起弄潮 AI 之巔!
崗位詳情請戳:
【加入社群】
新智元 AI 技術 + 產業社群招募中,歡迎對 AI 技術 + 產業落地感興趣的同學,加小助手微信號:aiera2015_2 入群;通過審核後我們將邀請進群,加入社群後務必修改群備註(姓名 - 公司 - 職位;專業群審核較嚴,敬請諒解)。