应网友要求,汇总了上百道历年微软面试中出现的算法题,该帖子根据牛客网上网友们分享的微软面经汇集而成,保证整理的每一道算法题都在面试中出现过:

img

根据这个些算法题,大家可以看到大厂算法习惯考查的方向,也可以更有针对性的准备面试,希望对大家有用。每一题目的出处与原始牛客链接对应关系见issues,以下是面试题整理的表格,分别注明了题目、出现的次数以及leetcode的链接:

题目 出现次数 链接
215. 数组中的第K个最大元素 6 https://leetcode-cn.com/problems/kth-largest-element-in-an-array
124. 二叉树中的最大路径和 4 https://leetcode-cn.com/problems/binary-tree-maximum-path-sum
468. 验证IP地址 3 https://leetcode-cn.com/problems/validate-ip-address
236. 二叉树的最近公共祖先 3 https://leetcode-cn.com/problems/lowest-common-ancestor-of-a-binary-tree
206. 反转链表 3 https://leetcode-cn.com/problems/reverse-linked-list
91. 解码方法 3 https://leetcode-cn.com/problems/decode-ways
94. 二叉树的中序遍历 3 https://leetcode-cn.com/problems/binary-tree-inorder-traversal
15. 三数之和 3 https://leetcode-cn.com/problems/3sum
121. 买卖股票的最佳时机 3 https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock
48. 旋转图像 3 https://leetcode-cn.com/problems/rotate-image
543. 二叉树的直径 3 https://leetcode-cn.com/problems/diameter-of-binary-tree
53. 最大子序和 3 https://leetcode-cn.com/problems/maximum-subarray
4. 寻找两个正序数组的中位数 2 https://leetcode-cn.com/problems/median-of-two-sorted-arrays
110. 平衡二叉树 2 https://leetcode-cn.com/problems/balanced-binary-tree
146. LRU缓存机制 2 https://leetcode-cn.com/problems/lru-cache
103. 二叉树的锯齿形层次遍历 2 https://leetcode-cn.com/problems/binary-tree-zigzag-level-order-traversal
450. 删除二叉搜索树中的节点 2 https://leetcode-cn.com/problems/delete-node-in-a-bst
415. 字符串相加 2 https://leetcode-cn.com/problems/add-strings
62. 不同路径 2 https://leetcode-cn.com/problems/unique-paths
22. 括号生成 2 https://leetcode-cn.com/problems/generate-parentheses
1. 两数之和 2 https://leetcode-cn.com/problems/two-sum
79. 单词搜索 2 https://leetcode-cn.com/problems/word-search
200. 岛屿数量 2 https://leetcode-cn.com/problems/number-of-islands
89. 格雷编码 2 https://leetcode-cn.com/problems/gray-code
98. 验证二叉搜索树 2 https://leetcode-cn.com/problems/validate-binary-search-tree
剑指 Offer 46. 把数字翻译成字符串 1 https://leetcode-cn.com/problems/ba-shu-zi-fan-yi-cheng-zi-fu-chuan-lcof
84. 柱状图中最大的矩形 1 https://leetcode-cn.com/problems/largest-rectangle-in-histogram
120. 三角形最小路径和 1 https://leetcode-cn.com/problems/triangle
5. 最长回文子串 1 https://leetcode-cn.com/problems/longest-palindromic-substring
867. 转置矩阵 1 https://leetcode-cn.com/problems/transpose-matrix
560. 和为K的子数组 1 https://leetcode-cn.com/problems/subarray-sum-equals-k
986. 区间列表的交集 1 https://leetcode-cn.com/problems/interval-list-intersections
78. 子集 1 https://leetcode-cn.com/problems/subsets
907. 子数组的最小值之和 1 https://leetcode-cn.com/problems/sum-of-subarray-minimums
162. 寻找峰值 1 https://leetcode-cn.com/problems/find-peak-element
547. 朋友圈 1 https://leetcode-cn.com/problems/friend-circles
1013. 将数组分成和相等的三个部分 1 https://leetcode-cn.com/problems/partition-array-into-three-parts-with-equal-sum
34. 在排序数组中查找元素的第一个和最后一个位置 1 https://leetcode-cn.com/problems/find-first-and-last-position-of-element-in-sorted-array
142. 环形链表 II 1 https://leetcode-cn.com/problems/linked-list-cycle-ii
572. 另一个树的子树 1 https://leetcode-cn.com/problems/subtree-of-another-tree
154. 寻找旋转排序数组中的最小值 II 1 https://leetcode-cn.com/problems/find-minimum-in-rotated-sorted-array-ii
704. 二分查找 1 https://leetcode-cn.com/problems/binary-search
151. 翻转字符串里的单词 1 https://leetcode-cn.com/problems/reverse-words-in-a-string
171. Excel表列序号 1 https://leetcode-cn.com/problems/excel-sheet-column-number
39. 组合总和 1 https://leetcode-cn.com/problems/combination-sum
150. 逆波兰表达式求值 1 https://leetcode-cn.com/problems/evaluate-reverse-polish-notation
283. 移动零 1 https://leetcode-cn.com/problems/move-zeroes
767. 重构字符串 1 https://leetcode-cn.com/problems/reorganize-string
10. 正则表达式匹配 1 https://leetcode-cn.com/problems/regular-expression-matching
459. 重复的子字符串 1 https://leetcode-cn.com/problems/repeated-substring-pattern
973. 最接近原点的 K 个点 1 https://leetcode-cn.com/problems/k-closest-points-to-origin
3. 无重复字符的最长子串 1 https://leetcode-cn.com/problems/longest-substring-without-repeating-characters
72. 编辑距离 1 https://leetcode-cn.com/problems/edit-distance
剑指 Offer 21. 调整数组顺序使奇数位于偶数前面 1 https://leetcode-cn.com/problems/diao-zheng-shu-zu-shun-xu-shi-qi-shu-wei-yu-ou-shu-qian-mian-lcof
剑指 Offer 36. 二叉搜索树与双向链表 1 https://leetcode-cn.com/problems/er-cha-sou-suo-shu-yu-shuang-xiang-lian-biao-lcof
887. 鸡蛋掉落 1 https://leetcode-cn.com/problems/super-egg-drop
剑指 Offer 26. 树的子结构 1 https://leetcode-cn.com/problems/shu-de-zi-jie-gou-lcof
328. 奇偶链表 1 https://leetcode-cn.com/problems/odd-even-linked-list
137. 只出现一次的数字 II 1 https://leetcode-cn.com/problems/single-number-ii
155. 最小栈 1 https://leetcode-cn.com/problems/min-stack
剑指 Offer 52. 两个链表的第一个公共节点 1 https://leetcode-cn.com/problems/liang-ge-lian-biao-de-di-yi-ge-gong-gong-jie-dian-lcof
1375. 灯泡开关 III 1 https://leetcode-cn.com/problems/bulb-switcher-iii
662. 二叉树最大宽度 1 https://leetcode-cn.com/problems/maximum-width-of-binary-tree
76. 最小覆盖子串 1 https://leetcode-cn.com/problems/minimum-window-substring
449. 序列化和反序列化二叉搜索树 1 https://leetcode-cn.com/problems/serialize-and-deserialize-bst
47. 全排列 II 1 https://leetcode-cn.com/problems/permutations-ii
300. 最长上升子序列 1 https://leetcode-cn.com/problems/longest-increasing-subsequence
152. 乘积最大子数组 1 https://leetcode-cn.com/problems/maximum-product-subarray
44. 通配符匹配 1 https://leetcode-cn.com/problems/wildcard-matching
739. 每日温度 1 https://leetcode-cn.com/problems/daily-temperatures
122. 买卖股票的最佳时机 II 1 https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-ii
20. 有效的括号 1 https://leetcode-cn.com/problems/valid-parentheses
207. 课程表 1 https://leetcode-cn.com/problems/course-schedule
700. 二叉搜索树中的搜索 1 https://leetcode-cn.com/problems/search-in-a-binary-search-tree
701. 二叉搜索树中的插入操作 1 https://leetcode-cn.com/problems/insert-into-a-binary-search-tree
1312. 让字符串成为回文串的最少插入次数 1 https://leetcode-cn.com/problems/minimum-insertion-steps-to-make-a-string-palindrome
剑指 Offer 33. 二叉搜索树的后序遍历序列 1 https://leetcode-cn.com/problems/er-cha-sou-suo-shu-de-hou-xu-bian-li-xu-lie-lcof
139. 单词拆分 1 https://leetcode-cn.com/problems/word-break
557. 反转字符串中的单词 III 1 https://leetcode-cn.com/problems/reverse-words-in-a-string-iii
60. 第k个排列 1 https://leetcode-cn.com/problems/permutation-sequence
剑指 Offer 04. 二维数组中的查找 1 https://leetcode-cn.com/problems/er-wei-shu-zu-zhong-de-cha-zhao-lcof

推荐阅读