作者: 负雪明烛
id: fuxuemingzhu
个人博客: http://fuxuemingzhu.cn/
公众号:负雪明烛
本文关键词:刷题顺序,刷题路径,好题,top100,怎么刷题,Leetcode, 力扣,Python, C++, Java
大家好,相信很多朋友在刷题时,看到 LeetCode 的 2000 多道题目,有点手足无措,非常需要一个刷题的顺序和清单。
我整理了在 LeetCode(中文版)上点赞数前 100 的题目,这些的题目基本都在千赞以上,全部都是好题。
举个例子,1. Two Sum(两数之和)这个题目有着全站最高的点赞数:11757!!这题也是经典中的经典了,肯定要掌握的。
LeetCode top 100 liked 题目列表
下面的表格根据 Likes 数目对题目进行了排序。
题号 | 英文题名 | 中文题名 | 难度 | likes 数 | 标签 | 中文力扣地址 | 英文 LeetCode 地址 |
---|---|---|---|---|---|---|---|
1 | Two Sum | 两数之和 | Easy | 11757 | 数组,哈希表 | https://leetcode-cn.com/problems/two-sum/ | https://leetcode.com/problems/two-sum/ |
2 | Add Two Numbers | 两数相加 | Medium | 6524 | 递归,链表,数学 | https://leetcode-cn.com/problems/add-two-numbers/ | https://leetcode.com/problems/add-two-numbers/ |
3 | Longest Substring Without Repeating Characters | 无重复字符的最长子串 | Medium | 5845 | 哈希表,字符串,滑动窗口 | https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/ | https://leetcode.com/problems/longest-substring-without-repeating-characters/ |
4 | Median of Two Sorted Arrays | 寻找两个正序数组的中位数 | Hard | 4303 | 数组,二分查找,分治 | https://leetcode-cn.com/problems/median-of-two-sorted-arrays/ | https://leetcode.com/problems/median-of-two-sorted-arrays/ |
5 | Longest Palindromic Substring | 最长回文子串 | Medium | 3896 | 字符串,动态规划 | https://leetcode-cn.com/problems/longest-palindromic-substring/ | https://leetcode.com/problems/longest-palindromic-substring/ |
15 | 3Sum | 三数之和 | Medium | 3582 | 数组,双指针,排序 | https://leetcode-cn.com/problems/3sum/ | https://leetcode.com/problems/3sum/ |
53 | Maximum Subarray | 最大子序和 | Easy | 3533 | 数组,分治,动态规划 | https://leetcode-cn.com/problems/maximum-subarray/ | https://leetcode.com/problems/maximum-subarray/ |
7 | Reverse Integer | 整数反转 | Easy | 2970 | 数学 | https://leetcode-cn.com/problems/reverse-integer/ | https://leetcode.com/problems/reverse-integer/ |
11 | Container With Most Water | 盛最多水的容器 | Medium | 2659 | 贪心,数组,双指针 | https://leetcode-cn.com/problems/container-with-most-water/ | https://leetcode.com/problems/container-with-most-water/ |
42 | Trapping Rain Water | 接雨水 | Hard | 2552 | 栈,数组,双指针,动态规划,单调栈 | https://leetcode-cn.com/problems/trapping-rain-water/ | https://leetcode.com/problems/trapping-rain-water/ |
20 | Valid Parentheses | 有效的括号 | Easy | 2544 | 栈,字符串 | https://leetcode-cn.com/problems/valid-parentheses/ | https://leetcode.com/problems/valid-parentheses/ |
10 | Regular Expression Matching | 正则表达式匹配 | Hard | 2273 | 递归,字符串,动态规划 | https://leetcode-cn.com/problems/regular-expression-matching/ | https://leetcode.com/problems/regular-expression-matching/ |
26 | Remove Duplicates from Sorted Array | 删除有序数组中的重复项 | Easy | 2146 | 数组,双指针 | https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array/ | https://leetcode.com/problems/remove-duplicates-from-sorted-array/ |
136 | Single Number | 只出现一次的数字 | Easy | 1958 | 位运算,数组 | https://leetcode-cn.com/problems/single-number/ | https://leetcode.com/problems/single-number/ |
22 | Generate Parentheses | 括号生成 | Medium | 1946 | 字符串,动态规划,回溯 | https://leetcode-cn.com/problems/generate-parentheses/ | https://leetcode.com/problems/generate-parentheses/ |
206 | Reverse Linked List | 反转链表 | Easy | 1886 | 递归,链表 | https://leetcode-cn.com/problems/reverse-linked-list/ | https://leetcode.com/problems/reverse-linked-list/ |
21 | Merge Two Sorted Lists | 合并两个有序链表 | Easy | 1832 | 递归,链表 | https://leetcode-cn.com/problems/merge-two-sorted-lists/ | https://leetcode.com/problems/merge-two-sorted-lists/ |
70 | Climbing Stairs | 爬楼梯 | Easy | 1791 | 记忆化搜索,数学,动态规划 | https://leetcode-cn.com/problems/climbing-stairs/ | https://leetcode.com/problems/climbing-stairs/ |
300 | Longest Increasing Subsequence | 最长递增子序列 | Medium | 1773 | 数组,二分查找,动态规划 | https://leetcode-cn.com/problems/longest-increasing-subsequence/ | https://leetcode.com/problems/longest-increasing-subsequence/ |
121 | Best Time to Buy and Sell Stock | 买卖股票的最佳时机 | Easy | 1766 | 数组,动态规划 | https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock/ | https://leetcode.com/problems/best-time-to-buy-and-sell-stock/ |
72 | Edit Distance | 编辑距离 | Hard | 1743 | 字符串,动态规划 | https://leetcode-cn.com/problems/edit-distance/ | https://leetcode.com/problems/edit-distance/ |
14 | Longest Common Prefix | 最长公共前缀 | Easy | 1707 | 字符串 | https://leetcode-cn.com/problems/longest-common-prefix/ | https://leetcode.com/problems/longest-common-prefix/ |
198 | House Robber | 打家劫舍 | Medium | 1585 | 数组,动态规划 | https://leetcode-cn.com/problems/house-robber/ | https://leetcode.com/problems/house-robber/ |
9 | Palindrome Number | 回文数 | Easy | 1568 | 数学 | https://leetcode-cn.com/problems/palindrome-number/ | https://leetcode.com/problems/palindrome-number/ |
146 | LRU Cache | LRU 缓存机制 | Medium | 1544 | 设计,哈希表,链表,双向链表 | https://leetcode-cn.com/problems/lru-cache/ | https://leetcode.com/problems/lru-cache/ |
19 | Remove Nth Node From End of List | 删除链表的倒数第 N 个结点 | Medium | 1494 | 链表,双指针 | https://leetcode-cn.com/problems/remove-nth-node-from-end-of-list/ | https://leetcode.com/problems/remove-nth-node-from-end-of-list/ |
33 | Search in Rotated Sorted Array | 搜索旋转排序数组 | Medium | 1493 | 数组,二分查找 | https://leetcode-cn.com/problems/search-in-rotated-sorted-array/ | https://leetcode.com/problems/search-in-rotated-sorted-array/ |
46 | Permutations | 全排列 | Medium | 1484 | 数组,回溯 | https://leetcode-cn.com/problems/permutations/ | https://leetcode.com/problems/permutations/ |
101 | Symmetric Tree | 对称二叉树 | Easy | 1483 | 树,深度优先搜索,广度优先搜索,二叉树 | https://leetcode-cn.com/problems/symmetric-tree/ | https://leetcode.com/problems/symmetric-tree/ |
84 | Largest Rectangle in Histogram | 柱状图中最大的矩形 | Hard | 1472 | 栈,数组,单调栈 | https://leetcode-cn.com/problems/largest-rectangle-in-histogram/ | https://leetcode.com/problems/largest-rectangle-in-histogram/ |
39 | Combination Sum | 组合总和 | Medium | 1466 | 数组,回溯 | https://leetcode-cn.com/problems/combination-sum/ | https://leetcode.com/problems/combination-sum/ |
13 | Roman to Integer | 罗马数字转整数 | Easy | 1436 | 哈希表,数学,字符串 | https://leetcode-cn.com/problems/roman-to-integer/ | https://leetcode.com/problems/roman-to-integer/ |
23 | Merge k Sorted Lists | 合并K个升序链表 | Hard | 1436 | 链表,分治,堆(优先队列),归并排序 | https://leetcode-cn.com/problems/merge-k-sorted-lists/ | https://leetcode.com/problems/merge-k-sorted-lists/ |
17 | Letter Combinations of a Phone Number | 电话号码的字母组合 | Medium | 1436 | 哈希表,字符串,回溯 | https://leetcode-cn.com/problems/letter-combinations-of-a-phone-number/ | https://leetcode.com/problems/letter-combinations-of-a-phone-number/ |
322 | Coin Change | 零钱兑换 | Medium | 1414 | 广度优先搜索,数组,动态规划 | https://leetcode-cn.com/problems/coin-change/ | https://leetcode.com/problems/coin-change/ |
32 | Longest Valid Parentheses | 最长有效括号 | Hard | 1400 | 栈,字符串,动态规划 | https://leetcode-cn.com/problems/longest-valid-parentheses/ | https://leetcode.com/problems/longest-valid-parentheses/ |
287 | Find the Duplicate Number | 寻找重复数 | Medium | 1325 | 位运算,数组,双指针,二分查找 | https://leetcode-cn.com/problems/find-the-duplicate-number/ | https://leetcode.com/problems/find-the-duplicate-number/ |
122 | Best Time to Buy and Sell Stock II | 买卖股票的最佳时机 II | Easy | 1306 | 贪心,数组,动态规划 | https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-ii/ | https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/ |
160 | Intersection of Two Linked Lists | 相交链表 | Easy | 1302 | 哈希表,链表,双指针 | https://leetcode-cn.com/problems/intersection-of-two-linked-lists/ | https://leetcode.com/problems/intersection-of-two-linked-lists/ |
55 | Jump Game | 跳跃游戏 | Medium | 1292 | 贪心,数组,动态规划 | https://leetcode-cn.com/problems/jump-game/ | https://leetcode.com/problems/jump-game/ |
76 | Minimum Window Substring | 最小覆盖子串 | Hard | 1280 | 哈希表,字符串,滑动窗口 | https://leetcode-cn.com/problems/minimum-window-substring/ | https://leetcode.com/problems/minimum-window-substring/ |
200 | Number of Islands | 岛屿数量 | Medium | 1270 | 深度优先搜索,广度优先搜索,并查集,数组,矩阵 | https://leetcode-cn.com/problems/number-of-islands/ | https://leetcode.com/problems/number-of-islands/ |
78 | Subsets | 子集 | Medium | 1269 | 位运算,数组,回溯 | https://leetcode-cn.com/problems/subsets/ | https://leetcode.com/problems/subsets/ |
31 | Next Permutation | 下一个排列 | Medium | 1260 | 数组,双指针 | https://leetcode-cn.com/problems/next-permutation/ | https://leetcode.com/problems/next-permutation/ |
96 | Unique Binary Search Trees | 不同的二叉搜索树 | Medium | 1257 | 树,二叉搜索树,数学,动态规划,二叉树 | https://leetcode-cn.com/problems/unique-binary-search-trees/ | https://leetcode.com/problems/unique-binary-search-trees/ |
148 | Sort List | 排序链表 | Medium | 1248 | 链表,双指针,分治,排序,归并排序 | https://leetcode-cn.com/problems/sort-list/ | https://leetcode.com/problems/sort-list/ |
236 | Lowest Common Ancestor of a Binary Tree | 二叉树的最近公共祖先 | Medium | 1238 | 树,深度优先搜索,二叉树 | https://leetcode-cn.com/problems/lowest-common-ancestor-of-a-binary-tree/ | https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/ |
25 | Reverse Nodes in k-Group | K 个一组翻转链表 | Hard | 1230 | 递归,链表 | https://leetcode-cn.com/problems/reverse-nodes-in-k-group/ | https://leetcode.com/problems/reverse-nodes-in-k-group/ |
6 | ZigZag Conversion | Z 字形变换 | Medium | 1226 | 字符串 | https://leetcode-cn.com/problems/zigzag-conversion/ | https://leetcode.com/problems/zigzag-conversion/ |
152 | Maximum Product Subarray | 乘积最大子数组 | Medium | 1223 | 数组,动态规划 | https://leetcode-cn.com/problems/maximum-product-subarray/ | https://leetcode.com/problems/maximum-product-subarray/ |
215 | Kth Largest Element in an Array | 数组中的第K个最大元素 | Medium | 1211 | 数组,分治,快速选择,排序,堆(优先队列) | https://leetcode-cn.com/problems/kth-largest-element-in-an-array/ | https://leetcode.com/problems/kth-largest-element-in-an-array/ |
8 | String to Integer (atoi) | 字符串转换整数 (atoi) | Medium | 1168 | 字符串 | https://leetcode-cn.com/problems/string-to-integer-atoi/ | https://leetcode.com/problems/string-to-integer-atoi/ |
41 | First Missing Positive | 缺失的第一个正数 | Hard | 1163 | 数组,哈希表 | https://leetcode-cn.com/problems/first-missing-positive/ | https://leetcode.com/problems/first-missing-positive/ |
283 | Move Zeroes | 移动零 | Easy | 1162 | 数组,双指针 | https://leetcode-cn.com/problems/move-zeroes/ | https://leetcode.com/problems/move-zeroes/ |
141 | Linked List Cycle | 环形链表 | Easy | 1161 | 哈希表,链表,双指针 | https://leetcode-cn.com/problems/linked-list-cycle/ | https://leetcode.com/problems/linked-list-cycle/ |
98 | Validate Binary Search Tree | 验证二叉搜索树 | Medium | 1156 | 树,深度优先搜索,二叉搜索树,二叉树 | https://leetcode-cn.com/problems/validate-binary-search-tree/ | https://leetcode.com/problems/validate-binary-search-tree/ |
124 | Binary Tree Maximum Path Sum | 二叉树中的最大路径和 | Hard | 1152 | 树,深度优先搜索,动态规划,二叉树 | https://leetcode-cn.com/problems/binary-tree-maximum-path-sum/ | https://leetcode.com/problems/binary-tree-maximum-path-sum/ |
105 | Construct Binary Tree from Preorder and Inorder Traversal | 从前序与中序遍历序列构造二叉树 | Medium | 1149 | 树,数组,哈希表,分治,二叉树 | https://leetcode-cn.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/ | https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/ |
34 | Find First and Last Position of Element in Sorted Array | 在排序数组中查找元素的第一个和最后一个位置 | Medium | 1137 | 数组,二分查找 | https://leetcode-cn.com/problems/find-first-and-last-position-of-element-in-sorted-array/ | https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/ |
239 | Sliding Window Maximum | 滑动窗口最大值 | Hard | 1114 | 队列,数组,滑动窗口,单调队列,堆(优先队列) | https://leetcode-cn.com/problems/sliding-window-maximum/ | https://leetcode.com/problems/sliding-window-maximum/ |
142 | Linked List Cycle II | 环形链表 II | Medium | 1097 | 哈希表,链表,双指针 | https://leetcode-cn.com/problems/linked-list-cycle-ii/ | https://leetcode.com/problems/linked-list-cycle-ii/ |
139 | Word Break | 单词拆分 | Medium | 1097 | 字典树,记忆化搜索,哈希表,字符串,动态规划 | https://leetcode-cn.com/problems/word-break/ | https://leetcode.com/problems/word-break/ |
45 | Jump Game II | 跳跃游戏 II | Medium | 1094 | 贪心,数组,动态规划 | https://leetcode-cn.com/problems/jump-game-ii/ | https://leetcode.com/problems/jump-game-ii/ |
169 | Majority Element | 多数元素 | Easy | 1089 | 数组,哈希表,分治,计数,排序 | https://leetcode-cn.com/problems/majority-element/ | https://leetcode.com/problems/majority-element/ |
234 | Palindrome Linked List | 回文链表 | Easy | 1072 | 栈,递归,链表,双指针 | https://leetcode-cn.com/problems/palindrome-linked-list/ | https://leetcode.com/problems/palindrome-linked-list/ |
62 | Unique Paths | 不同路径 | Medium | 1072 | 数学,动态规划,组合数学 | https://leetcode-cn.com/problems/unique-paths/ | https://leetcode.com/problems/unique-paths/ |
189 | Rotate Array | 旋转数组 | Medium | 1057 | 数组,数学,双指针 | https://leetcode-cn.com/problems/rotate-array/ | https://leetcode.com/problems/rotate-array/ |
94 | Binary Tree Inorder Traversal | 二叉树的中序遍历 | Easy | 1052 | 栈,树,深度优先搜索,二叉树 | https://leetcode-cn.com/problems/binary-tree-inorder-traversal/ | https://leetcode.com/problems/binary-tree-inorder-traversal/ |
56 | Merge Intervals | 合并区间 | Medium | 1051 | 数组,排序 | https://leetcode-cn.com/problems/merge-intervals/ | https://leetcode.com/problems/merge-intervals/ |
88 | Merge Sorted Array | 合并两个有序数组 | Easy | 1041 | 数组,双指针,排序 | https://leetcode-cn.com/problems/merge-sorted-array/ | https://leetcode.com/problems/merge-sorted-array/ |
560 | Subarray Sum Equals K | 和为K的子数组 | Medium | 1036 | 数组,哈希表,前缀和 | https://leetcode-cn.com/problems/subarray-sum-equals-k/ | https://leetcode.com/problems/subarray-sum-equals-k/ |
279 | Perfect Squares | 完全平方数 | Medium | 1035 | 广度优先搜索,数学,动态规划 | https://leetcode-cn.com/problems/perfect-squares/ | https://leetcode.com/problems/perfect-squares/ |
35 | Search Insert Position | 搜索插入位置 | Easy | 1005 | 数组,二分查找 | https://leetcode-cn.com/problems/search-insert-position/ | https://leetcode.com/problems/search-insert-position/ |
24 | Swap Nodes in Pairs | 两两交换链表中的节点 | Medium | 996 | 递归,链表 | https://leetcode-cn.com/problems/swap-nodes-in-pairs/ | https://leetcode.com/problems/swap-nodes-in-pairs/ |
85 | Maximal Rectangle | 最大矩形 | Hard | 983 | 栈,数组,动态规划,矩阵,单调栈 | https://leetcode-cn.com/problems/maximal-rectangle/ | https://leetcode.com/problems/maximal-rectangle/ |
28 | Implement strStr() | 实现 strStr() | Easy | 982 | 双指针,字符串,字符串匹配 | https://leetcode-cn.com/problems/implement-strstr/ | https://leetcode.com/problems/implement-strstr/ |
92 | Reverse Linked List II | 反转链表 II | Medium | 980 | 链表 | https://leetcode-cn.com/problems/reverse-linked-list-ii/ | https://leetcode.com/problems/reverse-linked-list-ii/ |
155 | Min Stack | 最小栈 | Easy | 979 | 栈,设计 | https://leetcode-cn.com/problems/min-stack/ | https://leetcode.com/problems/min-stack/ |
79 | Word Search | 单词搜索 | Medium | 979 | 数组,回溯,矩阵 | https://leetcode-cn.com/problems/word-search/ | https://leetcode.com/problems/word-search/ |
27 | Remove Element | 移除元素 | Easy | 967 | 数组,双指针 | https://leetcode-cn.com/problems/remove-element/ | https://leetcode.com/problems/remove-element/ |
51 | N-Queens | N 皇后 | Hard | 965 | 数组,回溯 | https://leetcode-cn.com/problems/n-queens/ | https://leetcode.com/problems/n-queens/ |
75 | Sort Colors | 颜色分类 | Medium | 961 | 数组,双指针,排序 | https://leetcode-cn.com/problems/sort-colors/ | https://leetcode.com/problems/sort-colors/ |
102 | Binary Tree Level Order Traversal | 二叉树的层序遍历 | Medium | 960 | 树,广度优先搜索,二叉树 | https://leetcode-cn.com/problems/binary-tree-level-order-traversal/ | https://leetcode.com/problems/binary-tree-level-order-traversal/ |
48 | Rotate Image | 旋转图像 | Medium | 960 | 数组,数学,矩阵 | https://leetcode-cn.com/problems/rotate-image/ | https://leetcode.com/problems/rotate-image/ |
95 | Unique Binary Search Trees II | 不同的二叉搜索树 II | Medium | 955 | 树,二叉搜索树,动态规划,回溯,二叉树 | https://leetcode-cn.com/problems/unique-binary-search-trees-ii/ | https://leetcode.com/problems/unique-binary-search-trees-ii/ |
64 | Minimum Path Sum | 最小路径和 | Medium | 954 | 数组,动态规划,矩阵 | https://leetcode-cn.com/problems/minimum-path-sum/ | https://leetcode.com/problems/minimum-path-sum/ |
406 | Queue Reconstruction by Height | 根据身高重建队列 | Medium | 947 | 贪心,数组,排序 | https://leetcode-cn.com/problems/queue-reconstruction-by-height/ | https://leetcode.com/problems/queue-reconstruction-by-height/ |
226 | Invert Binary Tree | 翻转二叉树 | Easy | 941 | 树,深度优先搜索,广度优先搜索,二叉树 | https://leetcode-cn.com/problems/invert-binary-tree/ | https://leetcode.com/problems/invert-binary-tree/ |
437 | Path Sum III | 路径总和 III | Medium | 937 | 树,深度优先搜索,二叉树 | https://leetcode-cn.com/problems/path-sum-iii/ | https://leetcode.com/problems/path-sum-iii/ |
104 | Maximum Depth of Binary Tree | 二叉树的最大深度 | Easy | 937 | 树,深度优先搜索,广度优先搜索,二叉树 | https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/ | https://leetcode.com/problems/maximum-depth-of-binary-tree/ |
237 | Delete Node in a Linked List | 删除链表中的节点 | Easy | 936 | 链表 | https://leetcode-cn.com/problems/delete-node-in-a-linked-list/ | https://leetcode.com/problems/delete-node-in-a-linked-list/ |
337 | House Robber III | 打家劫舍 III | Medium | 929 | 树,深度优先搜索,动态规划,二叉树 | https://leetcode-cn.com/problems/house-robber-iii/ | https://leetcode.com/problems/house-robber-iii/ |
18 | 4Sum | 四数之和 | Medium | 918 | 数组,双指针,排序 | https://leetcode-cn.com/problems/4sum/ | https://leetcode.com/problems/4sum/ |
91 | Decode Ways | 解码方法 | Medium | 904 | 字符串,动态规划 | https://leetcode-cn.com/problems/decode-ways/ | https://leetcode.com/problems/decode-ways/ |
207 | Course Schedule | 课程表 | Medium | 897 | 深度优先搜索,广度优先搜索,图,拓扑排序 | https://leetcode-cn.com/problems/course-schedule/ | https://leetcode.com/problems/course-schedule/ |
37 | Sudoku Solver | 解数独 | Hard | 897 | 数组,回溯,矩阵 | https://leetcode-cn.com/problems/sudoku-solver/ | https://leetcode.com/problems/sudoku-solver/ |
175 | Combine Two Tables | 组合两个表 | Easy | 891 | 数据库 | https://leetcode-cn.com/problems/combine-two-tables/ | https://leetcode.com/problems/combine-two-tables/ |
416 | Partition Equal Subset Sum | 分割等和子集 | Medium | 886 | 数组,动态规划 | https://leetcode-cn.com/problems/partition-equal-subset-sum/ | https://leetcode.com/problems/partition-equal-subset-sum/ |
238 | Product of Array Except Self | 除自身以外数组的乘积 | Medium | 885 | 数组,前缀和 | https://leetcode-cn.com/problems/product-of-array-except-self/ | https://leetcode.com/problems/product-of-array-except-self/ |
114 | Flatten Binary Tree to Linked List | 二叉树展开为链表 | Medium | 877 | 栈,树,深度优先搜索,链表,二叉树 | https://leetcode-cn.com/problems/flatten-binary-tree-to-linked-list/ | https://leetcode.com/problems/flatten-binary-tree-to-linked-list/ |
2021 年 8 月 8 日于北京