1 |
[leetcode]243. Shortest Word Distance最短单词距离 |
Two Pointers |
2 |
[leetcode]244. Shortest Word Distance II最短单词距离(允许连环call) |
HashMap+Merge Sort |
3 |
[leetcode]245. Shortest Word Distance III最短单词距离(word1可能等于word2) |
Two Pointers |
4 |
[leetcode]15. 3Sum三数之和 |
Two Pointers(left&right) |
5 |
[leetcode]611. Valid Triangle Number有效三角数 |
Two Pointers(left&right) |
6 |
[leetcode]76. Minimum Window Substring最小字符串窗口 |
Two Pointers(Sliding Window) |
7 |
[leetcode]3. Longest Substring Without Repeating Characters无重复字母的最长子串 |
Two Pointers(Sliding Window) |
8 |
[leetcode]349. Intersection of Two Arrays数组交集 |
HashSet |
9 |
[leetcode]1. Two Sum两数之和 |
HashMap |
10 |
[leetcode]170. Two Sum III - Data structure design两数之和III - 数据结构设计 |
HashMap |
11 |
[leetcode]149. Max Points on a Line多点共线 |
HashMap |
12 |
[leetcode]205. Isomorphic Strings 同构字符串 |
HashMap |
13 |
[leetcode]706. Design HashMap设计HashMap
|
HashMap |
14 |
[leetcode]748. Shortest Completing Word能覆盖车牌最短单词 |
HashMap |
15 |
[leetcode]535. Encode and Decode TinyURL短网址的编解码器 |
HashMap |
16 |
[leetcode]380. Insert Delete GetRandom O(1)常数时间插入删除取随机值 |
HashMap+ArrayList |
17 |
[leetcode]381. Insert Delete GetRandom O(1) - Duplicates allowed常数时间插入删除取随机值(有重) |
HashMap+ArrayList |
18 |
[leetcode]146. LRU CacheLRU缓存 |
HashMap+Doubly LinkedList |
19 |
[leetcode]432. All O`one Data Structure 全O(1)数据结构 |
HashMap+Doubly LinkedList |
20 |
[leetcode]460. LFU Cache最低频率缓存 |
HashMap+Doubly LinkedList |
21 |
[leetcode]256. Paint House粉刷房子(三色可选) |
DP(Array) |
22 |
[leetcode]265. Paint House II粉刷房子(K色可选) |
DP(Array) |
23 |
[leetcode]198. House Robber小偷 |
DP(Array) |
24 |
[leetcode]53. Maximum Subarray最大子数组和 |
DP(Array) |
25 |
[leetcode]152. Maximum Product Subarray最大乘积子数组 |
DP(Array) |
26 |
[leetcode]300. Longest Increasing Subsequence最长递增子序列 |
DP(Array) |
27 |
[leetcode]416. Partition Equal Subset Sum分割数组的和相同子集 |
DP(Array)-2D |
28 |
[leetcode]879. Profitable Schemes盈利计划 |
DP(Array)-3D |
29 |
[leetcode]322. Coin Change找零钱 |
DP(Array)-2D |
30 |
[leetcode]70. Climbing Stairs爬楼梯 |
DP(Array) |
31 |
[leetcode]5. Longest Palindromic Substring最长回文子串 |
DP(String) |
32 |
[leetcode]516. Longest Palindromic Subsequence最长回文子序列 |
DP(String) |
33 |
[leetcode]730. Count Different Palindromic Subsequences计数不同的回文子序列的个数 |
DP(String) |
34 |
[leetcode]647. Palindromic Substrings 回文子串 |
DP(String) |
35
|
[leetcode]72. Edit Distance 最少编辑步数 |
DP(String) |
|
[leetcode]297. Serialize and Deserialize Binary Tree 序列化与反序列化二叉树 |
Queue |
|
[leetcode]449. Serialize and Deserialize BST序列化反序列化BST(尽量紧凑) |
Queue |
|
[leetcode]428. Serialize and Deserialize N-ary Tree序列化与反序列化N叉树 |
Queue |
|
[leetcode]341. Flatten Nested List Iterator展开嵌套列表的迭代器 |
Queue |
|
[leetcode]339. Nested List Weight Sum嵌套列表加权和 |
DFS/BFS |
|
[leetcode]364. Nested List Weight Sum II嵌套列表加权和II |
DFS/BFS |
|
[leetcode]102. Binary Tree Level Order Traversal二叉树水平遍历 |
BFS |
|
[leetcode]103. Binary Tree Zigzag Level Order Traversal二叉树Z形遍历 |
BFS |
|
[leetcode]200. Number of Islands岛屿个数 |
DFS(Floodfill) |
|
[leetcode]695. Max Area of Island小岛最大面积 |
DFS(Floodfill) |
|
[leetcode]694. Number of Distinct Islands你究竟有几个异小岛? |
DFS(Floodfill) |
|
[leetcode]112. Path Sum路径和(是否有路径) |
DFS(Backtracking) |
|
[leetcode]113. Path Sum II路径和(返回路径) |
DFS(Backtracking) |
|
[leetcode]46. Permutations全排列(给定序列无重复元素) |
DFS(Backtracking) |
|
[leetcode]47. Permutations全排列(给定序列有重复元素) |
DFS(Backtracking) |
|
[leetcode]79. Word Search找单词 |
DFS(Backtracking) |
|
[leetcode]254. Factor Combinations因式组合 |
DFS(Backtracking) |
|
[leetcode]78. Subsets数组子集 |
DFS(Backtracking) |
|
[leetcode]39. Combination Sum组合之和 |
DFS(Backtracking) |
|
[leetcode]40. Combination Sum II组合之和(每元素限用一次) |
DFS(Backtracking) |
|
[leetcode]377. Combination Sum IV组合之和(允许相同元素不同顺序的组合结果) |
DP(Array) |
|
[leetcode]282. Expression Add Operators 表达式添加运算符 |
DFS(树形问题) |
|
[leetcode]671. Second Minimum Node In a Binary Tree二叉树次小结点 |
DFS(树形问题) |
|
[leetcode]464. Can I Win我能获胜吗 |
DFS(树形问题) |
|
[leetcode]17. Letter Combinations of a Phone Number手机键盘的字母组合 |
DFS(树形问题) |
|
[leetcode]468. Validate IP Address验证有效IP地址 |
DFS(树形问题) |
|
[leetcode]156.Binary Tree Upside Down颠倒二叉树 |
DFS(Tree) |
|
[leetcode]366. Find Leaves of Binary Tree捡树叶 |
DFS(Tree) |
|
[leetcode]236. LCA of a Binary Tree二叉树最近公共祖先
|
DFS(Tree) |
|
[leetcode]235. LCA of a Binary Search Tree BST的最近公共祖先 |
DFS(Tree) |
|
[leetcode]100. Same Tree相同的树 |
DFS(Tree) |
|
[leetcode]101. Symmetric Tree对称树 |
DFS(Tree) |
|
[leetcode]104. Maximum Depth of Binary Tree二叉树最大深度 |
DFS(Tree) |
|
[leetcode]98. Validate Binary Search Tree验证二叉搜索树 |
DFS(Tree) |
|
[leetcode]270. Closest Binary Search Tree Value二叉搜索树中找target的最接近值 |
Tree |
|
[leetcode]272. Closest Binary Search Tree Value II二叉搜索树中最近的值II |
Deque/LinkedList |
|
[leetcode]173. Binary Search Tree Iterator 二叉搜索树迭代器 |
Tree |
|
655 Print Binary Tree |
Tree |
|
450 Delete Node in a BST |
Tree |
|
701 Insert into a BST |
Tree |
|
[leetcode]226. Invert Binary Tree翻转二叉树 |
Tree |
|
208 Implement Trie (Prefix Tree) |
Tree |
|
515 Find Largest Value in Each Tree Row |
Tree |
|
[leetcode]127. Word Ladder单词接龙 |
Queue |
|
[leetcode]126. Word Ladder II单词接龙II |
DFS+BFS |
|
[leetcode]716. Max Stack 最大栈 |
Stack |
|
[leetcode]155. Min Stack最小栈 |
Stack |
|
[leetcode]150. Evaluate Reverse Polish Notation逆波兰表示法 |
Stack |
|
[leetcode]20. Valid Parentheses有效括号序列 |
Stack |
|
[leetcode]636. Exclusive Time of Functions函数独占时间 |
Stack |
|
[leetcode]946. Validate Stack Sequences用Stack验证序列 |
Stack |
|
[leetcode]215. Kth Largest Element in an Array 数组中第k大的元素 |
PriorityQueue |
|
[leetcode]23. Merge k Sorted Lists归并k个有序链表 |
PriorityQueue |
|
[leetcode]347. Top K Frequent Elements 最高频的K个元素 |
PriorityQueue |
|
[leetcode]692. Top K Frequent Words 最高频的K个单词
|
PriorityQueue |
|
[leetcode]451. Sort Characters By Frequency按频率将字母排序 |
PriorityQueue |
|
[leetcode]373. Find K Pairs with Smallest Sums找出和最小的前K对 |
PriorityQueue |
|
[leetcode]160. Intersection of Two Linked Lists两链表交点 |
LinkedList |
|
[leetcode]61. Rotate List旋转链表 |
LinkedList |
|
[leetcode]141. Linked List Cycle判断链表是否循环 |
LinkedList |
|
[leetcode]142. Linked List Cycle II找出循环链表的入口 |
LinkedList |
|
[leetcode]2. Add Two Numbers两数相加 |
LinkedList |
|
[leetcode]21. Merge Two Sorted Lists合并两个链表 |
LinkedList |
|
382.Linked List Random Node Medium |
LinkedList |
|
138.Copy List with Random Pointer |
LinkedList |
|
[leetcode]56. Merge Intervals归并区间 |
Sort(Interval) |
|
[leetcode]57. Insert Interval插入区间 |
Sort(Interval) |
|
352 Data Stream as Disjoint Intervals |
Sort(Interval) |
|
715 Range Module |
Sort(Interval) |
|
[leetcode]88. Merge Sorted Array归并有序数组 |
Sort(Merge) |
|
207 Course Schedule Medium |
Sort(Topological) |
|
[leetcode]50. Pow(x, n)求幂 |
Sort(Binary Search) |
|
[leetcode]34.Find First and Last Position of Element in Sorted Array找区间 |
Sort(Binary Search) |
|
[leetcode]33. Search in Rotated Sorted Array旋转过有序数组里找目标值 |
Sort(Binary Search) |
|
[leetcode]153. Find Minimum in Rotated Sorted Array旋转过有序数组里找最小 |
Sort(Binary Search) |
|
[leetcode]744. Find Smallest Letter Greater Than Target大于Target的最小字母 |
Sort(Binary Search) |
|
[leetcode]69. Sqrt(x)开方 |
Sort(Binary Search) |
|
[leetcode]81. Search in Rotated Sorted Array II旋转过有序数组里找目标值II(有重) |
Sort(Binary Search) |
|
[leetcode]528. Random Pick with Weight按权重挑选索引 |
Sort(Binary Search) |
|
[leetcode]367. Valid Perfect Square验证完全平方数 |
Sort(Binary Search) |
|
[leetcode]4. Median of Two Sorted Arrays俩有序数组的中位数 |
Sort(Binary Search) |
|
[leetcode]658. Find K Closest Elements绝对距离最近的K个元素 |
Sort(Binary Search) |
|
[leetcode]319. Bulb Switcher灯泡开关 |
Math |
|
[leetcode]7. Reverse Integer反转整数 |
Math |
|
[leetcode]412. Fizz Buzz报数 |
Math |
|
[leetcode]296. Best Meeting Point最佳见面地点 |
Math |
|
[leetcode]633. Sum of Square Numbers平方数之和 |
Math |
|
[leetcode]133. Clone Graph 克隆图 |
Graph |
|
[leetcode]261. Graph Valid Tree有效树形图 |
Union Find |
|
323 Number of Connected Components in an Undirected Graph Medium |
Union Find |
|
547 Friend Circles Medium |
Union Find |
|
[leetcode]384. Shuffle an Array洗牌 |
Array |
|
[leetcode]277. Find the Celebrity 找名人 |
Array |
|
[leetcode]311. Sparse Matrix Multiplication 稀疏矩阵相乘 |
Array |
|
[leetcode]238. Product of Array Except Self除了自身以外的数组元素乘积 |
Array |
|
[leetcode]31. Next Permutation下一个排列 |
Array |
|
[leetcode]128. Longest Consecutive Sequence最长连续序列 |
Array |
|
[leetcode]122. Best Time to Buy and Sell Stock II 最佳炒股时机之二 |
Array |
|
251 Flatten 2D Vector |
Array |
|
[leetcode]65. Valid Number 有效数值 |
String |
|
[leetcode]68. Text Justification文字对齐 |
String |
|
[leetcode]12. Integer to Roman整数转罗马数字 |
String |
|
[leetcode]13. Roman to Integer罗马数字转整数 |
String |
|
[leetcode]273. Integer to English Words 整数转英文单词 |
String |
|
[leetcode]151. Reverse Words in a String翻转给定字符串中的单词 |
String |
|
[leetcode]8. String to Integer (atoi)字符串转整数 |
String |
|
796 Rotate String |
String |
|
344 Reverse String |
String |
|
[leetcode]605. Can Place Flowers能放花吗 |
Greedy |