GitHub高星!互联网公司最常见的面试算法题大集合

人工智能头条  ·  2019-07-31 09:39:18

GitHub高星!互联网公司最常见的面试算法题大集合

【导读】LeetCode是一个美国的在线编程网站,收集了各个大厂的笔试面试题,对找工作的毕业生和开发者来说,非常有价值。很多求职者都会在LeetCode刷上一遍,面试官也喜欢在上面挑选各类题目。

 

LeetCode是一个美国的在线编程网站,收集了各个大厂的笔试面试题,对找工作的毕业生和开发者来说,非常有价值。不过LeetCode上面的题目很多都是考察应聘者对基础知识的应用,适合进行练习编程基础或者准备面试。

 

很多求职者都会在LeetCode刷上一遍,面试官也喜欢在上面挑选各类题目。今天新智元给大家推荐的这个GitHub项目,是Repo主自己刷题的心路历程,并给出了解题参考。该项目目前分为四个部分:

 

  1. 第一个部分是 leetcode 经典题目的解析,包括思路,关键点和具体的代码实现

  2. 第二部分是对于数据结构与算法的总结

  3. 第三部分是 anki 卡片, 将 leetcode 题目按照一定的方式记录在 anki 中,方便大家记忆

  4. 第四部分是计划, 这里会记录将来要加入到以上三个部分内容

 

只有熟练掌握基础的数据结构与算法,才能对复杂问题迎刃有余。

 

食用指南

 

最近添加的部分, 前面会有 🆕 标注;最近更新的部分,前面会有 🖊 标注;将来会在这里更新anki卡片。

 

leetcode官方账号在知乎上给出的一个《互联网公司最常见的面试算法题有哪些?》的答案,原文地址: 

https://www.zhihu.com/question/24964987/answer/586425979

 

一张互联网公司面试中经常考察的问题类型总结的思维导图,我们可以结合图片中的信息分析一下。

 

其中算法,主要是以下几种:

 

  • 基础技巧:分治、二分、贪心

  • 排序算法:快速排序、归并排序、计数排序

  • 搜索算法:回溯、递归、深度优先遍历,广度优先遍历,二叉搜索树等

  • 图论:最短路径、最小生成树

  • 动态规划:背包问题、最长子序列

 

数据结构,主要有如下几种:

 

  • 数组与链表:单 / 双向链表

  • 栈与队列

  • 哈希表

  • 堆:最大堆 / 最小堆

  • 树与图:最近公共祖先、并查集

  • 字符串:前缀树(字典树) / 后缀树

 

精彩预告

 

42.trapping-rain-water-1(雨水收集问题):

 

 

浏览器中的栈:

 

 

回溯法解题:

 

 

875. koko-eating-bananas:

 

 

传送门

 

leetcode 经典题目的解析

 

简单难度

 

🖊 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 卡片

 

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/

分享 :
上一篇下一篇
推荐阅读

参与评论

登录 后参与评论

文章评论(0)