| 3 |
数组中重复的数字 |
287. Find the Duplicate Number |
注意细微差别 |
| 4 |
二维数组中的查找 |
240. Search a 2D Matrix II |
|
| 7 |
重建二叉树 |
105. Construct Binary Tree from Preorder and Inorder Traversal |
|
| 9 |
用两个栈实现队列 |
232. Implement Queue using Stacks |
|
| 10 |
斐波那契数列 |
509. Fibonacci Number, 70. Climbing Stairs |
|
| 11 |
旋转数组中的最小数字 |
153. Find Minimum in Rotated Sorted Array |
|
| 12 |
矩阵中的路径 |
79. Word Search |
|
| 15 |
二进制中1的个数 |
191. Number of 1 Bits |
|
| 16 |
数值的整数次方 |
50. Pow(x, n) |
|
| 18 |
一、在O(1)时间内删除链表节点 |
237. Delete Node in a Linked List |
略有不同 |
| 18 |
二、删除链表中重复的节点 |
82. Remove Duplicates from Sorted List II |
|
| 19 |
正则表达式匹配 |
10. Regular Expression Matching |
|
| 20 |
表示数值的字符串 |
65. Valid Number |
|
| 21 |
调整数组顺序使奇数位于偶数之前 |
905. Sort Array By Parity |
要求刚好相反 |
| 22 |
链表中倒数第k个节点 |
19. Remove Nth Node From End of List |
查找然后删除 |
| 23 |
链表中环的入口节点 |
142. Linked List Cycle II |
|
| 24 |
反转链表 |
206. Reverse Linked List |
|
| 25 |
合并两个排序的链表 |
21. Merge Two Sorted Lists |
|
| 26 |
树的子结构 |
572. Subtree of Another Tree |
略有不同 |
| 27 |
二叉树的镜像 |
226. Invert Binary Tree |
|
| 28 |
对称的二叉树 |
101. Symmetric Tree |
|
| 29 |
顺时针打印矩阵 |
54. Spiral Matrix |
|
| 30 |
包含min函数的栈 |
155. Min Stack |
|
| 31 |
栈的压入、弹出序列 |
946. Validate Stack Sequences |
|
| 32 |
一、不分行从上到下打印二叉树 |
无 |
|
| 32 |
二、分行从上到下打印二叉树 |
102. Binary Tree Level Order Traversal |
|
| 32 |
三、之字型打印二叉树 |
103. Binary Tree Zigzag Level Order Traversal |
|
| 33 |
二叉搜索树的后序遍历序列 |
255. Verify Preorder Sequence in Binary Search Tree |
有锁 |
| 34 |
二叉树中和为某一值的路径 |
113. Path Sum II |
|
| 35 |
复杂链表的复制 |
138. Copy List with Random Pointer |
|
| 36 |
二叉搜索树与双向链表 |
426. Convert Binary Search Tree to Sorted Doubly Linked List |
有锁 |
| 37 |
序列化二叉树 |
297. Serialize and Deserialize Binary Tree |
|
| 38 |
字符串的排列 |
46. Permutations |
无重复元素 |
| 38 |
字符串的排列 |
47. Permutations II |
有重复元素 |
| 38 |
扩展:字符串的组合 |
77. Combinations |
|
| 39 |
数组中出现次数超过一半的数字 |
169. Majority Element |
|
| 40 |
最小的k个数 |
215. Kth Largest Element in an Array |
略有不同 |
| 41 |
数据流中的中位数 |
295. Find Median from Data Stream |
|
| 42 |
连续子数组的最大和 |
53. Maximum Subarray |
|
| 43 |
1到n整数中1出现的次数 |
233. Number of Digit One |
|
| 44 |
数字序列中某一位的数字 |
400. Nth Digit |
|
| 45 |
把数组排成最小的数 |
179. Largest Number |
刚好相反 |
| 46 |
把数字翻译成字符串 |
91. Decode Ways |
略有不同 |
| 47 |
礼物的最大价值 |
64. Minimum Path Sum |
刚好相反 |
| 48 |
最长不含重复字符的子字符串 |
3. Longest Substring Without Repeating Characters |
|
| 49 |
丑数 |
264. Ugly Number II |
|
| 50 |
一、字符串中第一个只出现一次的字符 |
387. First Unique Character in a String |
|
| 50 |
二、字符流中第一个只出现一次的字符 |
无 |
|
| 51 |
数组中的逆序对 |
493. Reverse Pairs |
略有不同 |
| 52 |
两个链表的第一个公共节点 |
160. Intersection of Two Linked Lists |
|
| 53 |
一、数字在排序数组中出现的次数 |
34. Find First and Last Position of Element in Sorted Array |
|
| 53 |
二、0 ~ n-1中缺失的数字 |
268. Missing Number |
略有不同 |
| 53 |
三、排序数组中数值和下标相等的元素 |
无 |
|
| 54 |
二叉搜索树的第k大节点 |
230. Kth Smallest Element in a BST |
|
| 55 |
一、二叉树的深度 |
104. Maximum Depth of Binary Tree |
|
| 55 |
二、平衡二叉树 |
110. Balanced Binary Tree |
|
| 56 |
一、数组中只出现一次的两个数字 |
260. Single Number III |
|
| 56 |
二、数组中唯一只出现一次的数字 |
137. Single Number II |
|
| 57 |
一、和为s的两个数字 |
167. Two Sum II - Input array is sorted |
|
| 57 |
二、和为s的连续正整数序列 |
829. Consecutive Numbers Sum |
|
| 58 |
一、翻转单词顺序 |
151. Reverse Words in a String |
|
| 58 |
二、左旋转字符串 |
189. Rotate Array |
略有不同 |
| 59 |
一、滑动窗口的最大值 |
239. Sliding Window Maximum |
|
| 60 |
n个骰子的点数 |
1155. Number of Dice Rolls With Target Sum |
略有不同 |
| 61 |
扑克牌中的顺子 |
无 |
|
| 62 |
圆圈中最后剩下的数字 |
无 |
|
| 63 |
股票的最大利润 |
121. Best Time to Buy and Sell Stock |
|
| 64 |
求1+2+...+n |
无 |
|