算法
面经统计共 316 道,按知识体系分成 14 组,组内按出现次数降序。 数据来源 osjobs Top K,抓取于 2026-11-12。
排序与复杂度(30)
- 283 - 使用递归及非递归两种方式实现快速排序
- 160 - 快速排序的空间复杂度是多少?时间复杂度的最好最坏的情况是多少,有哪些优化方案?
- 91 - 33. 搜索旋转排序数组
- 84 - 常用的排序方式有哪些,时间复杂度是多少?
- 65 - 153. 寻找旋转排序数组中的最小值
- 62 - 简述你熟悉的几个排序算法以及优缺点
- 54 - 堆排序的时间复杂度是多少?说几个堆排序的应用场景
- 50 - 81. 搜索旋转排序数组 II
- 44 - 34. 在排序数组中查找元素的第一个和最后一个位置
- 38 - 给定一个包含 40 亿个无符号整数的大型文件,使用最多 1G 内存,对此文件进行排序
- 38 - 83. 删除排序链表中的重复元素
- 36 - JMM 中内存模型是怎样的?什么是指令序列重排序?
- 32 - 有序链表插入的时间复杂度是多少?
- 32 - 哪些排序算法是稳定排序?
- 30 - 哈希表常见操作的时间复杂度是多少?遇到哈希冲突是如何解决的?
- 30 - 什么是排序算法中的稳定性?
- 30 - 按奇偶排序数组 II (Leetcode)
- 24 - 手写冒泡排序
- 21 - 33. Search in Rotated Sorted Array
- 20 - 一手顺子 (Leetcode 846)
- 19 - 23. Merge k Sorted Lists
- 18 - 846. 一手顺子
- 18 - 493. 翻转对
- 16 - 数组中的逆序对 (Leetcode)
- 16 - 实现归并排序
- 16 - 简述内部排序以及外部排序的常见算法
- 14 - 扑克牌中的顺子
- 14 - 4. Median of Two Sorted Arrays
- 13 - 88. Merge Sorted Array
- 10 - 拓扑排序是唯一的吗?
链表(16)
- 216 - 141. 环形链表
- 196 - 206. 反转链表
- 193 - 19. 删除链表的倒数第 N 个结点
- 126 - 21. 合并两个有序链表
- 56 - 25. K 个一组翻转链表
- 38 - 23. 合并K个升序链表
- 34 - 142. 环形链表 II
- 22 - 143. 重排链表
- 19 - 138. Copy List with Random Pointer
- 18 - 92. 反转链表 II
- 18 - 160. 相交链表
- 15 - 234. 回文链表
- 14 - 876. 链表的中间结点
- 14 - 203. Remove Linked List Elements
- 14 - 725. Split Linked List in Parts
- 10 - 234. Palindrome Linked List
树与二叉树(50)
- 133 - 112. 路径总和
- 116 - 102. 二叉树的层序遍历
- 80 - AVL 树和红黑树有什么区别?
- 80 - 236. 二叉树的最近公共祖先
- 65 - 103. 二叉树的锯齿形层序遍历
- 52 - 144. 二叉树的前序遍历
- 52 - 145. 二叉树的后序遍历
- 50 - 236. Lowest Common Ancestor of a Binary Tree
- 50 - 124. Binary Tree Maximum Path Sum
- 48 - 红黑树是怎么实现平衡的?它的优点是什么?
- 48 - 94. 二叉树的中序遍历
- 40 - 226. 翻转二叉树
- 36 - 297. Serialize and Deserialize Binary Tree
- 32 - 199. 二叉树的右视图
- 30 - 105. Construct Binary Tree from Preorder and Inorder Traversal
- 29 - 116. Populating Next Right Pointers in Each Node
- 26 - 105. 从前序与中序遍历序列构造二叉树
- 23 - 106. Construct Binary Tree from Inorder and Postorder Traversal
- 23 - 99. Recover Binary Search Tree
- 22 - 103. Binary Tree Zigzag Level Order Traversal
- 18 - 108. 将有序数组转换为二叉搜索树
- 18 - 543. 二叉树的直径
- 18 - 1448. Count Good Nodes in Binary Tree
- 18 - 100. 相同的树
- 17 - 104. 二叉树的最大深度
- 16 - 面试题 04.04. 检查平衡性
- 16 - 98. 验证二叉搜索树
- 15 - 1382. Balance a Binary Search Tree
- 15 - 110. 平衡二叉树
- 14 - 617. 合并二叉树
- 14 - 199. Binary Tree Right Side View
- 14 - 543. Diameter of Binary Tree
- 14 - 340. Longest Substring with At Most K Distinct Characters
- 13 - 101. 对称二叉树
- 13 - 987. Vertical Order Traversal of a Binary Tree
- 12 - 二叉搜索树的第 k 大节点
- 12 - 117. Populating Next Right Pointers in Each Node II
- 11 - 124. 二叉树中的最大路径和
- 10 - 5. Longest Palindromic Substring
- 10 - 510. Inorder Successor in BST II
- 10 - 958. Check Completeness of a Binary Tree
- 10 - 863. All Nodes Distance K in Binary Tree
- 8 - 538. Convert BST to Greater Tree
- 6 - 173. Binary Search Tree Iterator
- 5 - 545. Boundary of Binary Tree
- 5 - 1293. Shortest Path in a Grid with Obstacles Elimination
- 5 - 1650. Lowest Common Ancestor of a Binary Tree III
- 4 - 129. Sum Root to Leaf Numbers
- 4 - 314. Binary Tree Vertical Order Traversal
- 2 - 828. Count Unique Characters of All Substrings of a Given String
二分与查找(11)
- 214 - 10亿个数中如何高效地找到最大的一个数以及最大的第 K 个数
- 112 - 215. 数组中的第K个最大元素
- 28 - 实现二分查找
- 18 - 74. 搜索二维矩阵
- 16 - 295. Find Median from Data Stream
- 14 - 375. Guess Number Higher or Lower II
- 14 - 1428. Leftmost Column with at Least a One
- 14 - 4. 寻找两个正序数组的中位数
- 12 - 1539. Kth Missing Positive Number
- 12 - 240. Search a 2D Matrix II
- 6 - 1200. Minimum Absolute Difference
图与搜索(30)
- 45 - 210. Course Schedule II
- 39 - 10亿条数据包括 id,上线时间,下线时间,请绘制每一秒在线人数的曲线图
- 34 - 旋转图像 (Leetcode)
- 28 - 200. Number of Islands
- 26 - 200. 岛屿数量
- 22 - 695. Max Area of Island
- 20 - 695. 岛屿的最大面积
- 20 - 133. Clone Graph
- 18 - 953. Verifying an Alien Dictionary
- 16 - 48. 旋转图像
- 16 - 317. Shortest Distance from All Buildings
- 15 - 126. Word Ladder II
- 14 - 迪杰斯特拉算法 和 A*算法区别
- 14 - 743. Network Delay Time
- 14 - 269. Alien Dictionary
- 12 - 1631. Path With Minimum Effort
- 12 - 827. Making A Large Island
- 12 - 127. Word Ladder
- 10 - 1254. Number of Closed Islands
- 10 - 1762. Buildings With an Ocean View
- 10 - 721. Accounts Merge
- 10 - 1197. Minimum Knight Moves
- 10 - 212. Word Search II
- 8 - 2184. Number of Ways to Build Sturdy Brick Wall
- 5 - 841. Keys and Rooms
- 5 - 489. Robot Room Cleaner
- 4 - 1091. Shortest Path in Binary Matrix
- 4 - 463. Island Perimeter
- 2 - 79. Word Search
- 2 - 1568. Minimum Number of Days to Disconnect Island
动态规划(34)
- 108 - 53. 最大子序和
- 103 - 300. 最长递增子序列
- 86 - 70. 爬楼梯
- 75 - 1143. 最长公共子序列
- 60 - 剑指 Offer 10- II. 青蛙跳台阶问题
- 28 - 121. Best Time to Buy and Sell Stock
- 25 - 279. Perfect Squares
- 24 - 264. 丑数 II
- 24 - 560. Subarray Sum Equals K
- 22 - 121. 买卖股票的最佳时机
- 16 - 不同路径 (Leetcode)
- 16 - 42. 接雨水
- 16 - 14. 最长公共前缀
- 16 - 329. Longest Increasing Path in a Matrix
- 16 - 523. Continuous Subarray Sum
- 15 - 1547. Minimum Cost to Cut a Stick
- 14 - 青蛙跳台阶问题
- 14 - 621. Task Scheduler
- 14 - 322. Coin Change
- 14 - 139. Word Break
- 12 - 322. 零钱兑换
- 12 - 最长和谐子序列 (Leetcode)
- 12 - 309. Best Time to Buy and Sell Stock with Cooldown
- 12 - 1377. Frog Position After T Seconds
- 12 - 746. Min Cost Climbing Stairs
- 11 - 135. Candy
- 11 - 63. Unique Paths II
- 11 - 45. Jump Game II
- 11 - 42. Trapping Rain Water
- 10 - 1406. Stone Game III
- 10 - 741. Cherry Pickup
- 6 - 64. 最小路径和
- 3 - 799. Champagne Tower
- 2 - 140. Word Break II
字符串(35)
- 59 - 125. 验证回文串
- 54 - 3. 无重复字符的最长子串
- 54 - 5. 最长回文子串
- 44 - 394. 字符串解码
- 29 - 1048. Longest String Chain
- 26 - 手写判断电话号码的正则表达式
- 20 - 验证IP地址 (Leetcode)
- 19 - 49. Group Anagrams
- 16 - 有效的括号 (Leetcode)
- 16 - 767. Reorganize String
- 16 - 8. 字符串转换整数 (atoi)
- 16 - 394. Decode String
- 15 - 151. Reverse Words in a String
- 15 - 65. Valid Number
- 15 - 1249. Minimum Remove to Make Valid Parentheses
- 14 - 344. 反转字符串
- 14 - 76. 最小覆盖子串
- 14 - 722. Remove Comments
- 14 - 165. 比较版本号
- 14 - 472. Concatenated Words
- 13 - 266. Palindrome Permutation
- 13 - 71. Simplify Path
- 12 - 第一个只出现一次的字符 (Leetcode)
- 12 - 回文子串 (Leetcode)
- 12 - 125. Valid Palindrome
- 12 - 415. Add Strings
- 11 - 1258. Synonymous Sentences
- 10 - 424. Longest Repeating Character Replacement
- 10 - 301. Remove Invalid Parentheses
- 10 - 921. Minimum Add to Make Parentheses Valid
- 7 - 937. Reorder Data in Log Files
- 7 - 186. Reverse Words in a String II
- 6 - 387. First Unique Character in a String
- 3 - 680. Valid Palindrome II
- 2 - 249. Group Shifted Strings
回溯与组合(5)
- 16 - 46. Ptermutations
- 14 - 46. 全排列
- 12 - 47. Permutations II
- 6 - 17. Letter Combinations of a Phone Number
- 3 - 90. Subsets II
并发与多线程(2)
- 93 - 1114. 按序打印
- 10 - 手写无锁队列
数组与矩阵(42)
- 56 - 如何从一个数组输出随机数组(洗牌算法)
- 52 - 多数元素 (Leetcode)
- 47 - 189. 旋转数组
- 47 - 88. 合并两个有序数组
- 35 - 169. 多数元素
- 34 - 56. Merge Intervals
- 30 - 128. 最长连续序列
- 30 - 56. 合并区间
- 28 - 54. 螺旋矩阵
- 28 - 4. 寻找两个正序数组的中位数
- 26 - 238. Product of Array Except Self
- 22 - 75. 颜色分类
- 20 - 498. 对角线遍历
- 20 - 1. 两数之和
- 18 - 缺失的第一个正数 (Leetcode)
- 18 - 973. K Closest Points to Origin
- 18 - 1095. Find in Mountain Array
- 16 - 48. Rotate Image
- 16 - 840. Magic Squares In Grid
- 15 - 150. Evaluate Reverse Polish Notation
- 15 - 1272. Remove Interval
- 14 - 391. Perfect Rectangle
- 14 - 253. Meeting Rooms II
- 14 - 381. Insert Delete GetRandom O(1) - Duplicates allowed
- 14 - 54. Spiral Matrix
- 14 - 1146. Snapshot Array
- 14 - 15. 三数之和
- 13 - 57. Insert Interval
- 12 - 每秒有 5万个 QQ 号登陆,怎么找出每小时登录区间在 5-10次 的所有 QQ 号
- 12 - 移掉K位数字 (Leetcode 402)
- 12 - 移除元素 (Leetcode)
- 12 - 7. 整数反转
- 12 - 632. Smallest Range Covering Elements from K Lists
- 12 - 如何找到无序数组的中位数?
- 12 - 867. Transpose Matrix
- 11 - 302. Smallest Rectangle Enclosing Black Pixels
- 11 - 1353. Maximum Number of Events That Can Be Attended
- 10 - 和为 K 的子数组 (Leetcode)
- 10 - 1777. Products Price For Each Store
- 9 - 442. Find All Duplicates in an Array
- 8 - 268. Missing Number
- 1 - 487. Max Consecutive Ones II
栈队列与设计题(25)
- 199 - 146. LRU 缓存机制
- 138 - 232. 用栈实现队列
- 59 - 155. 最小栈
- 56 - 常用的限流算法有哪些?简述令牌桶算法原理
- 45 - 146. LRU Cache
- 34 - 用队列实现栈 (Leetcode)
- 30 - 359. Logger Rate Limiter
- 28 - 157. Read N Characters Given Read4
- 22 - 227. Basic Calculator II
- 18 - 1268. Search Suggestions System
- 18 - 348. Design Tic-Tac-Toe
- 18 - 636. Exclusive Time of Functions
- 16 - 642. Design Search Autocomplete System
- 14 - 716. 最大栈
- 14 - 211. Design Add and Search Words Data Structure
- 14 - 380. Insert Delete GetRandom O(1)
- 13 - 308. Range Sum Query - Mutable
- 12 - 158. Read N Characters Given Read4 II
- 12 - 1825. Finding MK Average
- 11 - 284. Peeking Iterator
- 10 - 736. Parse Lisp Expression
- 9 - 460. LFU Cache
- 8 - 341. Flatten Nested List Iterator
- 6 - 224. Basic Calculator
- 3 - 155. Min Stack
哈希与海量数据(10)
- 92 - 给定 100G 的 URL 磁盘数据,使用最多 1G 内存,统计出现频率最高的 Top K 个 URL
- 70 - 两个 10G 大小包含 URL 数据的文件,最多使用 1G 内存,将这两个文件合并,并找到相同的 URL
- 66 - 简述布隆过滤器原理及其使用场景
- 28 - 136. 只出现一次的数字
- 22 - 692. Top K Frequent Words
- 17 - 1000 台机器,每台机器 1000 个文件,每个文件存储了 10 亿个整数,如何找到其中最小的 1000 个值?
- 14 - 两个文件包含无序的数字,数字的大小范围是0-500w左右。如何求两个文件中的重复的数据?
- 14 - 347. Top K Frequent Elements
- 12 - 如何获得抖音小视频每日点击量最高的 10个 视频
- 10 - 1429. First Unique Number
数学与概率(24)
- 76 - 470. 用 Rand7() 实现 Rand10()
- 52 - 64 匹马,8 个赛道,找出前 4 匹马最少需要比几次
- 50 - 如何随机生成不重复的 10 个 100 以内的数字?
- 43 - 179. 最大数
- 42 - 69. x 的平方根
- 40 - 如何通过一个不均匀的硬币得到公平的结果?
- 36 - 445. 两数相加 II
- 30 - 给定一个 foo 函数,60%的概率返回0,40%的概率返回1,如何利用 foo 函数实现一个 50% 返回 0 的函数?
- 30 - 398. Random Pick Index
- 24 - 如何实现大数运算
- 22 - 数字转换为中文 (例如 1008 = 一千零八)
- 20 - 2. 两数相加
- 20 - 两数相加 (Leetcode)
- 20 - 智力题 https://www.nowcoder.com/discuss/262595
- 18 - 1000 个苹果放在 10 个箱子里,保证 1-1000 中的任意数量的苹果都等于其中 N 个箱子苹果数量的总和,请问应该如何分配苹果在箱子中?
- 18 - 29. Divide Two Integers
- 16 - 273. Integer to English Words
- 14 - 1000 盏灯开着,1000 个人标号 1~1000 依次进入,每个人进去按一下自己标号倍数的开关,最后哪些灯亮着?
- 14 - 1056. Confusing Number
- 14 - 445. Add Two Numbers II
- 12 - 按权重随机选择 (Leetcode)
- 12 - 简述银行家算法
- 12 - 528. Random Pick with Weight
- 4 - 50. Pow(x, n)
其他(2)
- 26 - 简述常见的负载均衡算法
- 18 - 组件之间通信方式有哪些?