網際網路公司最常見的面試算法題大集合!

2021-03-02 計算機與軟體考研

來源:Github

編輯:元子

【導讀】LeetCode是一個美國的在線編程網站,收集了各個大廠的筆試面試題,對找工作的畢業生和開發者來說,非常有價值。很多求職者都會在LeetCode刷上一遍,面試官也喜歡在上面挑選各類題目。

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


您還可以在以下平臺找到我們

你點的每個在看,我都認真當成了喜歡

相關焦點

  • 網際網路公司最常見的面試算法題大集合
    來源:Github編輯:元子【新智元導讀】LeetCode是一個美國的在線編程網站,收集了各個大廠的筆試面試題
  • 網際網路公司最常見的面試算法題大集合!
    來源:新智元LeetCode是一個美國的在線編程網站,收集了各個大廠的筆試面試題,對找工作的畢業生和開發者來說
  • 雲計算工程師面試題集錦附指南:網際網路篇!
    說到面試題,主要分為三部分:算法部分、基礎知識和智力題目,算法部分無非就是常見的排序算法、堆棧算法等,可能會被問到所用程式語言中一些不常見的語法,但這肯定不是考察的重點,用過可以談談,沒用過就沒必要硬聊。Linux以及資料庫方面的知識同樣是重點考察對象,TCP/IP協議、網絡編程和多線程/多進程開發幾乎是任何一家公司面試的必問項。
  • 網際網路大廠算法面試題集合,看完我跪了!
    來源:https://github.com/azl397985856/leetcode介紹leetcode 題解
  • 數據分析師面試最常見的十道面試題分享!
    以下是容大教育小編日常整理的數據分析師面試時經常遇到的十道數據分析面試題,下面讓我們一起看看數據分析師面試最常見的十道面試題:1、海量日誌數據,提取出某日訪問百度次數最多的那個IP首先是這一天,並且是訪問百度的日誌中的IP取出來,逐個寫入到一個大文件中。
  • BAT七年經驗,卻抵不過外企面試的兩道算法題?
    打開APP BAT七年經驗,卻抵不過外企面試的兩道算法題? 這種公司仗著自己是外資,待遇一般,要求還很高,在中國端架子,但在國外根本不入流,不去也罷。 美企都是這種面試風格,問算法題要多一些。現在國內的網際網路不比國外差,沒必要去外資企業。
  • 揭秘小公司出身的我是怎樣拿下網際網路大公司offer,滿滿的都是套路
    大家都想進大公司,畢竟大公司的待遇和前景等都是優於小公司的,下面為大家揭秘,一個不知名的小公司java程式設計師,原先年薪不到15萬,通過自己的努力不斷的提升技術,最終收穫多個知名網際網路公司的Offer,年薪達到30多萬!
  • 機器學習工程師面試題集錦附指南:網際網路篇
    本文總結了部分一線網際網路公司機器學習工程師的面試題及面試指南,希望對各位技術人員的進階之路有所幫助。阿里巴巴根據參加過阿里巴巴機器學習算法工程師面試的技術人員反饋,總共需要經過四輪面試,前兩輪為技術考察,第三輪是交叉面試,最後一輪是人力面試。
  • 備戰跳槽季:大廠面試官總結 16 大常考算法知識點
    在如今的環境下,想要換一份理想的工作更是需要「找準時機,抓住機會」,當然在面試前的準備是必不可少的。極客大學邀請了算法訓練營的助教,請他們分享一下作為面試官喜歡考察候選人哪些能力、他們有哪些「 精選算法面試題 」。我們的助教們來自美團、百度或海外的一線網際網路公司,希望他們分享的經驗可以幫助到你。
  • TOP 48 算法和編程面試題,牛逼啊!
    你在申請這些工作時,肯定很想知道面試官會問到哪些問題。在本文中,作者會分享一些常見的編程面試問題,這些問題來自於針對不同經驗層次的程式設計師的面試——從應屆畢業生到具有一兩年經驗的程式設計師。編程面試題通常包含數據結構和基於算法的問題,以及一些邏輯問題,例如:如何在不使用臨時變量的情況下交換兩個整數?為了清晰,編程面試題需要劃分為不同主題。
  • NLP、CV、語音相關AI算法工程師面試問題、代碼、簡歷模板、知識點等資源整理分享
    •面經(騰訊AI Lab,阿里達摩院,華為等公司大集合) nowcoder        •cv崗面經 nowcoder        •小菜雞的算法實習面經 nowcoder        •機器學習/算法校招面試考點匯總 nowcoder        •計算機視覺暑期實習面經 nowcoder
  • 500道Java 必備面試題答案(過後即刪)
    像阿里、騰訊、美團、字節跳動、京東等等的技術氛圍與技術規範度還是要明顯優於一些創業型公司/小公司,如果說能夠在這樣的公司鍛鍊幾年,相信對自己能力的提升還是非常大的。那怎樣才能快速拿到大廠的 Offer 呢?
  • 網際網路公司DBA面試指南集錦!
    本文總結了部分一線網際網路公司對DBA的面試要求,希望對所有DBA的職場進階有所幫助。除了基礎概念,百度可能會根據目前的業務發展特點詢問求職者可能的解決方案,比如有關海量數據的資料庫優化方法等問題,筆試環節求職者會拿到一張試卷,涉及的題型有選擇、填空、算法、簡單和設計題,運維研發和DBA後面的大題會有不同,筆試前務必認真準備作業系統和計算機網絡相關知識,DBA務必認真了解MySQL或者讀一下《高性能MySQL》這本書,會有很大幫助。
  • 知名網際網路公司校招 Java 開發崗面試知識點解析
    網際網路公司的校園招聘,從形式上說,面試一般分為 2-3 輪技術面試 +1 輪 HR 面試。但是一些公司確實是沒有 HR 面試的,直接就是三輪技術面。技術面試中,面試官一般會先就你所應聘的崗位進行相關知識的考察,也叫基礎知識和業務邏輯面試。只要你回答的不是特別差,面試官通常會說:「咱們寫個代碼吧」,這個時候就開始了算法面試。
  • Java 最常見的 200+ 面試題:面試必備
    聊回面試題這件事,這份面試清單原本是我們公司內部使用的,可到後來有很多朋友在微信上聯繫到我,讓我幫他們找一些面試方面的資料,而且這些關係也不太好拒絕,一呢,是因為這些找我,要面試題的人,不是我的好朋友的弟弟妹妹,就是我的弟弟妹妹們;二呢,我也不能馬馬虎虎的對付,受人之事忠人之命,我也不能辜負這份信任。
  • 求職FLAG必須掌握哪些算法和面試技巧?附「FB最新算法面試題」
    本文整理了近期FB 技術類職位的高頻面試題,以及FLAG大廠常見的個人背景問題、文化問題、經驗問題、技術問題、編程問題等常規性問題。同時給予了準備和回答的tips。這部分是面試中最難的,因為編程不僅是在高壓環境下進行,而且是以一種不熟悉的方式,比如白板手寫進行的,而且會有時間限制。所以要想通過編程問題面試,一定要提前多刷幾遍lintcode上的算法題。
  • 資源│機器學習、深度學習、算法工程師等 AI 相關崗位面試需要知識
    算法崗面經傳送門https://www.nowcoder.com/discuss/180976面經(騰訊 AI Lab,阿里達摩院,華為等公司大集合)https://www.nowcoder.com/discuss/180087cv 崗面經https://www.nowcoder.com/discuss/159266
  • 面試經驗分享之數據結構、算法題
    在正式介紹題目和準備方法之前,有兩點需要說明,Google 和 Facebook 這類對算法有很高要求的公司的在線測試我沒有參加過(不過在牛人內推幫助下有過面試體驗……),這超出了我目前的編碼能力範圍,網上有不少拿到 Google、Facebook offer 的經驗總結文章,可以移步觀賞;前段時間在微博上又看到有人說自己把 leetcode
  • 算法工程師面試問題及資料超詳細合集(多家公司算法崗面經/代碼實戰/網課/競賽等)
    阿里巴巴計算機視覺算法實習生視頻面試 website面試經驗AI算法工程師(面試官角度) website從零基礎到BAT算法崗SP——秋招準備攻略 website螞蟻金服/曠視/虹軟/騰訊優圖暑期實習offer面經 website我在美團的這兩年(附校招筆試/面試/面經分享) website1000 面試題,BAT
  • 資源 | 從算法到數據結構,百道面試問題實現答案集合
    、數據結構以及面試問題解決方案的集合,裡面的 repository 包含了我對常見算法問題的解答以及數據結構的實現(用 Java)。該資源集合處於持續更新中。項目地址:https://github.com/sherxon/AlgoDS目前為止,該資源集合提供了算法、數據結構以及 200 道面試題的答案。