Coding parctice based on LeetCode and Coding Interview book,
including algorithm, database, shell, concurrency problems and other online contests.
| # | Title Difficulty |
Category Solution |
Notes |
|---|---|---|---|
| 1 | Two Sum Easy |
Math Array Python3 |
枚举 哈希表 |
| 2 | Add Two Numbers Medium |
Math LinkedList Python3 |
模拟 |
| 3 | Longest Substring Without Repeating Characters Medium |
String Substring Python3 |
滑动窗口 |
| 4 | Median of Two Sorted Arrays Hard |
Array DevideAndConquer Python3 |
👊✔️ 模拟 归并排序 二分 |
| 5 | Longest Palindromic Substring Medium |
String Palindrome Python3 |
中心扩散法 DP |
| 6 | ZigZag Conversion Medium |
String Python3 |
模拟 找规律 |
| 7 | Reverse Integer Easy |
Math Python3 |
转化为字符串 模拟 |
| 8 | String to Integer (atoi) Medium |
Math Python3 |
模拟 |
| 9 | Palindrome Number Easy |
String Palindrome Python3 |
转化为字符串 模拟 |
| 10 | Regular Expression Matching Hard |
DynamicProgramming Python3 |
✊☑️ 递归 DP |
| 11 | Container With Most Water Medium |
Math, Array Python3 |
|
| 12 | Integer to Roman Medium |
String Python3 |
|
| 13 | Roman to Integer Easy |
String Python3 |
|
| 14 | Longest Common Prefix Easy |
String Python3 |
|
| 15 | 3Sum Medium |
Math Sum Python3 |
双指针法 |
| 16 | 3Sum Closest Medium |
Math Sum Python3 |
|
| 17 | Letter Combinations of a Phone Number Medium |
BackTracking Enumeration Python3 |
递归回溯 |
| 18 | 4Sum Medium |
Math Sum Python3 |
|
| 19 | Remove Nth Node From End of List Medium |
LinkedList Python3 |
|
| 20 | Valid Parentheses Easy |
String Parentheses Python3 |
|
| 21 | Merge Two Sorted Lists Easy |
LinkedList Python3 |
|
| 22 | Generate Parentheses Medium |
String Parentheses Python3 |
|
| 23 | Merge k Sorted Lists Hard |
LinkedList Python3 |
|
| 24 | Swap Nodes in Pairs Medium |
LinkedList Python3 |
dummynode 找规律 |
| 25 | Reverse Nodes in k-Group Hard |
LinkedList Python3 |
翻转拼接 |
| 26 | Remove Duplicates from Sorted Array Easy |
Array Python3 |
双指针移动 |
| 27 | Remove Element Easy |
Array Python3 |
|
| 28 | Implement strStr() Easy |
String Python3 |
字符串匹配 KMP算法 |
| 29 | Divide Two Integers Medium |
Math Python3 |
尽可能多减 |
| 30 | Substring with Concatenation of All Words | String Hard Python3 |
两种实现 |
| 31 | Next Permutation Medium |
Array Python3 |
规律模拟 |
| 32 | Longest Valid Parentheses Hard |
String DynamicProgramming Python3 |
👍✅😍 暴力枚举 栈模拟 动态规划 双向扫描 |
| 33 | Search in Rotated Sorted Array Medium |
Binary Search Python3 |
|
| 34 | Find First and Last Position of Element in Sorted Array Medium |
Binary Search Python3 |
构造二分性 >=target <=target |
| 35 | Search Insert Position Easy |
Array Python3 |
折半查找 找到 越界返回 |
| 36 | Valid Sudoku Medium |
BackTracking Python3 |
👍 row,col,cube判重 |
| 37 | Sudoku Solver Hard |
BackTracking Python3 |
👍 ✅ |
| 38 | Count and Say Easy |
String Python3 |
|
| 39 | Combination Sum Medium |
BackTracking Python3 |
|
| 40 | Combination Sum II Medium |
BackTracking Python3 |
排序 跳过重复元素 |
| 41 | First Missing Positive Hard |
Array Python3 |
👍 桶排序 |
| 42 | Trapping Rain Water Hard |
Array TwoPointers Stack Python3 |
👍✅ 多次线性扫描 双指针 |
| 43 | Multiply Strings Medium |
Math String Python3 |
👍 模拟 竖式乘法 大数相乘 |
| 44 | Wildcard Matching Hard |
String DynamicProgramming BackTracking Greedy Python3 |
☑️😍👍🔝 DP 双指针模拟 |
| 45 | Jump Game II Hard |
Array Greedy Python3 |
👍 贪心 |
| 46 | Permutations Medium |
BackTracking Python3 |
DFS+回溯 |
| 47 | Permutations II Medium |
BackTracking Python3 |
排序,跳过重复元素 |
| 48 | Rotate Image Medium |
Array Math Python3 |
👍 操作分解 |
| 49 | Group Anagrams Medium |
String Python3 |
三种方法求解 |
| 50 | Pow(x, n) Medium |
Math BinarySearch Python3 |
库函数 蛮力法 二分法 |
| 51 | N-Queens Medium |
BackTracking Python3 |
👍 ✅ |
| 52 | N-Queens II Hard |
BackTracking Python3 |
👍 ✅ |
| 53 | Maximum Subarray Easy |
Array Python3 |
|
| 54 | Spiral Matrix Medium |
Matrix Python3 |
过程模拟 边界处理 标记已访问 |
| 55 | Jump Game Medium |
Array Greedy Python3 |
👍 贪心 |
| 56 | Merge Intervals Medium |
Sort Python3 |
先排序后合并 |
| 57 | Insert Interval Hard |
Array Sort Python3 |
👍✅ 区间合并 |
| 58 | Length of Last Word Easy |
String Python3 |
长度之差 |
| 59 | Spiral Matrix II Medium |
Array Python3 |
简单模拟 |
| 60 | Permutation Sequence Medium |
Math BackTracking Python3 |
👍🔝✅ based on 46 based on 31 规律模拟 |
| 61 | Rotate List Medium |
LinkedList Python3 |
双指针定边界 |
| 62 | Unique Paths Medium |
Array DynamicProgramming Python3 |
👍✅ 递归 记忆递归 DP DP空间优化 组合数学 |
| 63 | Unique Paths II Medium |
Array DynamicProgramming Python3 |
👍✅ 动态规划 |
| 64 | Minimum Path Sum Medium |
Array DynamicProgramming Python3 |
普通DP 待优化 |
| 65 | Valid Number Hard |
Math String Python3 |
👍 正则 模拟 |
| 66 | Plus One Easy |
Array Python3 |
模拟 |
| 67 | Add Binary Easy |
Math String Python3 |
逐位处理 |
| 68 | Text Justification Hard |
String Python3 |
✅ 模拟 逐行处理拼接 |
| 69 | Sqrt(x) Easy |
Math Python3 |
二分查找 |
| 70 | Climbing Stairs Medium |
DynamicProgramming Python3 |
|
| 71 | Simplify Path Medium |
String Stack Python3 |
👍 栈的应用 |
| 72 | Edit Distance Hard |
DynamicProgramming Python3 |
👍✅ 最小编辑距离 |
| 73 | Set Matrix Zeroes Medium |
Array Python3 |
分配资源再利用 Trick |
| 74 | Search a 2D Matrix Medium |
BinarySearch Python3 |
构造两段性 |
| 75 | Sort Colors Medium |
Sort Python3 |
👍 计数排序 冒泡排序 三指针法 |
| 76 | Minimum Window Substring Hard |
HashTable TwoPointers String Sliding Window Python3 |
👍✅ 滑动窗口 |
| 77 | Combinations Medium |
BackTracking Python3 |
DFS回溯 |
| 78 | Subsets Medium |
BackTracking Python3 |
递归 非递归 |
| 79 | Word Search Medium |
Search BackTracking Array Python3 |
👍 DFS |
| 80 | Remove Duplicates from Sorted Array II Medium |
Array TwoPointers Python3 |
双指针遍历 |
| 81 | Search in Rotated Sorted Array II Medium |
Array BinarySearch Python3 |
🔝👍 两种二分写法 |
| 82 | Remove Duplicates from Sorted List II Medium |
LinkedList Python3 |
递归 双指针 |
| 83 | Remove Duplicates from Sorted List Easy |
LinkedList Python3 |
|
| 84 | Largest Rectangle in Histogram Hard |
Array Stack Python3 |
👍✅ 单调栈 |
| 85 | Maximal Rectangle Hard |
Array HashTable DynamicProgramming Stack Python3 |
👍✅ 单调栈 84题扩展 |
| 86 | Partition List Medium |
LinkedList TwoPointers Python3 |
模拟 双指划分合并 |
| 87 | Scramble String Hard |
BinaryTree Python3 |
递归暴力搜索 |
| 88 | Merge Sorted Array Easy |
Array Python3 |
线性合并 |
| 89 | Gray Code Medium |
BackTracking Python3 |
✅ 规律递归 |
| 90 | Subsets II Medium |
BackTracking Python3 |
78+过滤 |
| 91 | Decode Ways Medium |
DynamicProgramming String Python3 |
DP |
| 92 | Reverse Linked List II Medium |
LinkedList Python3 |
206变体 |
| 93 | Restore IP Addresses Medium |
String BackTracking Python3 |
👍 DFS递归 处理前缀0 |
| 94 | Binary Tree Inorder Traversal Medium |
BinaryTree Stack Python3 |
递归 迭代 |
| 95 | Unique Binary Search Trees II Medium |
DynamicProgramming BinarySearchTree Python3 |
👍😈 |
| 96 | Unique Binary Search Trees Medium |
DynamicProgramming BinarySearchTree Python3 |
👍 DP Catalan number |
| 97 | Interleaving String Hard |
DynamicProgramming String Python3 |
👍 DP |
| 98 | Validate Binary Search Tree Medium |
BinarySearchTree DFS Python3 |
DFS 中序遍历 |
| 99 | Recover Binary Search Tree Hard |
BinarySearchTree Python3 |
👍☑️ Morris-traversal |
| 100 | Same Tree Easy |
BinaryTree Python3 |
递归判断 |
| 101 | Symmetric Tree Easy |
BinaryTree DFS Python3 |
递归 迭代 |
| 102 | Binary Tree Level Order Traversal Medium |
BinaryTree BFS Python3 |
BFS逐层操作 |
| 103 | Binary Tree Zigzag Level Order Traversal Medium |
Stack BinaryTree BFS Python3 |
BFS模拟 |
| 104 | Maximum Depth of Binary Tree Easy |
BinaryTree Python3 |
基本递归 |
| 105 | Construct Binary Tree from Preorder and Inorder Traversal Medium |
BinaryTree DFS Python3 |
递归基本操作 |
| 106 | Construct Binary Tree from Inorder and Postorder Traversal Medium |
BinaryTree Array DFS Python3 |
递归模拟 |
| 107 | Binary Tree Level Order Traversal II Easy |
BinaryTree BFS Python3 |
BFS模拟 逆序输出 |
| 108 | Convert Sorted Array to Binary Search Tree Easy |
BinaryTree DFS Python3 |
递归中序遍历 |
| 109 | Convert Sorted List to Binary Search Tree Medium |
LinkedList DFS Python3 |
root节点的查找 |
| 110 | Balanced Binary Tree Easy |
BinaryTree DFS Python3 |
递归枚举 置标志位优化 |
| 111 | Minimum Depth of Binary Tree Easy |
BinaryTree DFS BFS Python3 |
👍🔝 递归DFS 栈DFS 队列BFS |
| 112 | Path Sum Easy |
BinaryTree DFS Python3 |
简单递归 |
| 113 | Path Sum II Medium |
BinaryTree DFS Python3 |
DFS递归 |
| 114 | Flatten Binary Tree to Linked List Medium |
BinaryTree DFS Python3 |
👍🔝☑️ 递归 迭代 非迭代 |
| 115 | Distinct Subsequences Hard |
String DynamicProgramming Python3 |
☑️🔝 DP |
| 116 | Populating Next Right Pointers in Each Node Medium |
BinaryTree Python3 |
BFS O(1)Space |
| 117 | Populating Next Right Pointers in Each Node II Medium |
BinaryTree Python3 |
BFS O(n)Space |
| 118 | Pascal's Triangle Medium |
Array Python3 |
模拟生成 |
| 119 | Pascal's Triangle II Easy |
Array Python3 |
👍✅🔝😍 双行模拟 单行自后向前 |
| 120 | Triangle Medium |
Array DynamicProgramming Python3 |
DP |
| 121 | Best Time to Buy and Sell Stock Easy |
Math Array DynamicProgramming Python3 |
|
| 122 | Best Time to Buy and Sell Stock II Easy |
Greedy Python3 |
贪心策略总结 |
| 123 | Best Time to Buy and Sell Stock III Hard |
DynamicProgramming Python3 |
👍✅ 贪心 DP |
| 124 | Binary Tree Maximum Path Sum Hard |
BinaryTree Python3 |
👍 DFS |
| 125 | Valid Palindrome Easy |
String TwoPointers Python3 |
正则 双指针线性扫描 |
| 126 | Word Ladder II Hard |
Array String BackTracking BFS Python3 |
👍🔝☑️ 双向BFS+hash |
| 127 | Word Ladder Medium |
BFS Python3 |
🔝☑️ BFS 双向BFS |
| 128 | Longest Consecutive Sequence Hard |
Array Greedy Python3 |
👍 哈希 |
| 129 | Sum Root to Leaf Numbers Medium |
BinaryTree DFS Python3 |
👍😍 迭代 递归 Morris-traversal |
| 130 | Surrounded Regions Medium |
DFS BFS UnionFind Python3 |
👍 BFS 逆向考虑 |
| 131 | Palindrome Partitioning Medium |
String BackTracking Python3 |
DFS 回溯 DP(TODO) |
| 133 | Clone Graph Medium |
Graph BFS DFS Python3 |
set去重 |
| 134 | Gas Station Medium |
Greddy Array Python3 |
贪心双指针 |
| 135 | Candy Hard |
Greedy Python3 |
☑️ 找规律 Trick |
| 136 | Single Number Easy |
HashTable BitManipulation Python3 |
字典应用 Awesome XOR! |
| 137 | Single Number II Medium |
HashTable BitManipulation Python3 |
hash 数学 Awesome XOR! |
| 138 | Copy List with Random Pointer Medium |
LinkedList Python3 |
Two Pass HashMap |
| 139 | Word Break Medium |
DynamicProgramming Python3 |
DP规律 |
| 140 | Word Break II Hard |
DynamicProgramming Python3 |
👍✅ DFS 记忆DP |
| 141 | Linked List Cycle Easy |
LinkedList Python3 |
快慢指针 |
| 142 | Linked List Cycle II Medium |
LinkedList Python3 |
龟兔赛跑 快慢指针法 |
| 143 | Reorder List Medium |
LinkedList Python3 |
找中点反转归并 |
| 144 | Binary Tree Preorder Traversal Medium |
BinaryTree Python3 |
递归法 栈迭代法 |
| 145 | Binary Tree Postorder Traversal Hard |
BinaryTree Python3 |
递归法 栈迭代法 |
| 146 | LRU Cache Medium |
LinkedList Python3 |
👍 哈希表+链表 |
| 147 | Insertion Sort List Medium |
LinkedList Python3 |
|
| 148 | Sort List Medium |
LinkedList Python3 |
👍 通过要求Strict |
| 149 | Max Points on a Line Hard |
HashTable Math Python3 |
👍☑️ 哈希表枚举 |
| 150 | Evaluate Reverse Polish Notation Medium |
Stack Python3 |
栈模拟 |
| 151 | Reverse Words in a String Medium |
String Python3 |
One Line Solution 数组翻转拼接 |
| 152 | Maximum Product Subarray Medium |
Array Counter Python3 |
👍 递归 |
| 153 | Find Minimum in Rotated Sorted Array Medium |
BinarySearch Python3 |
朴素 折半 |
| 154 | Find Minimum in Rotated Sorted Array II Hard |
Array BinarySearch Python3 |
👍 折半 |
| 155 | Min Stack Easy |
Stack PriorityQueue Python3 |
|
| 156 | Binary Tree Upside Down Medium |
BinaryTree Python3 |
🔒 栈模拟 |
| 157 | Read N Characters Given Read4 Easy |
String Python3 |
🔒 理解题意 |
| 158 | Read N Characters Given Read4 II - Call multiple times Hard |
String Python3 |
🔒 模拟 |
| 159 | Longest Substring with At Most Two Distinct Characters Hard |
HashTable TwoPointers String maxSlidingWindow Python3 |
👍🔒 滑动窗口 二刷滑动窗口 |
| 160 | Intersection of Two Linked Lists Easy |
LinkedList Python3 |
双指针 |
| 161 | One Edit Distance Medium |
String Python3 |
🔒 数组扫描 |
| 162 | Find Peak Element Medium |
BinarySearch Python3 |
单调区间的变换点 |
| 163 | Missing Ranges Medium |
Array Python3 |
👍lock: 模拟数组扫描 |
| 164 | Maximum Gap Hard |
Sort Python3 |
👍✅ 快速排序 基数排序 桶排序 鸽笼原理 |
| 165 | Compare Version Numbers Medium |
String Python3 |
字符串操作 |
| 166 | Fraction to Recurring Decimal Medium |
String HashTable Math Python3 |
循环节的处理 |
| 167 | Two Sum II - Input array is sorted Easy |
Math Sum Python3 |
哈希表 双指针 |
| 168 | Excel Sheet Column Title Easy |
Math Python3 |
模拟 |
| 169 | Majority Element Easy |
Array Python3 |
|
| 170 | Two Sum III - Data structure design Easy |
Design HashTable Python3 |
🔒 哈希简单应用 |
| 171 | Excel Sheet Column Number Easy |
Math Python3 |
遍历模拟 |
| 172 | Factorial Trailing Zeroes Easy |
Math BitManipulation Python3 |
👍 质数分解 |
| 173 | Binary Search Tree Iterator Easy |
BinarySearchTree Python3 |
栈模拟中序遍历 |
| 174 | Dungeon Game Hard |
BinarySearch DynamicProgramming Python3 |
👍🔝☑️ DP逆向推导 |
| 179 | Largest Number Medium |
Sort Python3 |
👍 自定义排序 Trick |
| 186 | Reverse Words in a String II Medium |
String Python3 |
🔒 模拟数组扫描 |
| 187 | Repeated DNA Sequences Medium |
String HashTable BitManipulation Python3 |
哈希 |
| 188 | Best Time to Buy and Sell Stock IV Hard |
DynamicProgramming Python3 |
👍✅ DP法1 DP法2优化 |
| 189 | Rotate Array Easy |
Array Python3 |
👍✅🔝 模拟 翻转数组 |
| 190 | Reverse Bits Easy |
BitManipulation Python3 |
位运算模拟 |
| 191 | Number of 1 Bits Easy |
BitManipulation Python3 |
循环计数 位运算优化 |
| 198 | House Robber Easy |
DynamicProgramming Python3 |
DP与空间优化 |
| 199 | Binary Tree Right Side View Medium |
BinaryTree DFS BFS Python3 |
层序遍历模拟 |
| 200 | Number of Islands Medium |
DFS BFS UnionFind Python3 |
👍 BFS 置0数1 |
| 201 | Bitwise AND of Numbers Range Medium |
BitManipulation Python3 |
找规律 位运算 |
| 202 | Happy Number Easy |
Math HashTable Python3 |
👍 字典模拟 龟兔赛跑 |
| 203 | Remove Linked List Elements Easy |
LinkedList Python3 |
模拟 头部节点的处理 |
| 204 | Count Primes Easy |
Math HashTable Python3 |
👍 筛法求素数 |
| 205 | Isomorphic Strings Easy |
String HashTable Python3 |
👍 哈希表映射 |
| 206 | Reverse Linked List Easy |
LinkedList Python3 |
逆序操作 |
| 207 | Course Schedule Medium |
TopologicalSort Python3 |
有向图中环是否存在 |
| 208 | Implement Trie (Prefix Tree) Medium |
Trie Python3 |
字典树 单词查找树 |
| 209 | Minimum Size Subarray Sum Medium |
Array TwoPointers BinarySearch Python3 |
双指针 滑动窗口 |
| 210 | Course Schedule II Medium |
DFS BFS TopologicalSort Python3 |
经典拓扑排序 |
| 211 | Add and Search Word - Data structure design Medium |
BackTracking Design Trie Python3 |
字典模拟 Trie(TODO) |
| 212 | Word Search II Hard |
String BackTracking Trie Python3 |
👍✅ 递归回溯 Trie优化 |
| 213 | House Robber II Medium |
DynamicProgramming Python3 |
Rob First Or Not |
| 214 | Shortest Palindrome Hard |
String Python3 |
👍✅ 最长前缀匹配 KMP优化 |
| 215 | Kth Largest Element in an Array Medium |
Stack PriorityQueue Python3 |
偷懒法 交换快排 最大堆 优先级队列 填坑快排 堆排 |
| 216 | Combination Sum III Medium |
BackTracking Python3 |
DFS |
| 217 | Contains Duplicate Easy |
Array HashTable Python3 |
水题 |
| 218 | The Skyline Problem Hard |
Array DivideAndConquer Heap BinaryIndexedTree SegmentTree LineSweep Python3 |
👍✅ 思路转化 优先级队列 heapq |
| 219 | Contains Duplicate II Easy |
Array HashTable Python3 |
哈希模拟 |
| 220 | Contains Duplicate III Medium |
Array Sort OrderedMap Python3 |
👍 滑动窗口 数学推导 |
| 221 | Maximal Square Medium |
DynamicProgramming Python3 |
👍 DP |
| 222 | Count Complete Tree Nodes Medium |
BinarySearch BinaryTree Python3 |
👍☑️ BS in BS |
| 223 | Rectangle Area Medium |
Math Python3 |
计算几何 |
| 224 | Basic Calculator Hard |
BackTracking Python3 |
值栈与符号栈 |
| 225 | Implement Stack using Queues Easy |
Stack Design Python3 |
双队实现栈 |
| 226 | Invert Binary Tree Easy |
BinaryTree Python3 |
递归 迭代 |
| 227 | Basic Calculator II Medium |
BackTracking Python3 |
乘除特殊处理 |
| 228 | Summary Ranges Medium |
Array Python3 |
模拟 线性扫描 |
| 229 | Majority Element II Medium |
Array Python3 |
👍 摩尔投票算法 |
| 230 | Kth Smallest Element in a BST Medium |
BinarySearchTree Python3 |
👍 递归 栈迭代 |
| 231 | Power of Two Easy |
Math BitManipulation Python3 |
基本数学 位运算 |
| 232 | Implement Queue using Stacks Easy |
Stack PriorityQueue Python3 |
双栈实现队列 |
| 234 | Palindrome Linked List Easy |
LinkedList TwoPointer Python3 |
双指针 |
| 235 | Lowest Common Ancestor of a Binary Search Tree Easy |
BinarySearchTree Python3 |
利用BST性质 |
| 236 | Lowest Common Ancestor of a Binary Tree Medium |
BinaryTree Python3 |
递归 |
| 237 | Delete Node in a Linked List Easy |
LinkedList Python3 |
取巧 |
| 238 | Product of Array Except Self Medium |
Array Math Python3 |
👍 前缀后缀积 |
| 239 | Sliding Window Maximum Hard |
Heap Sliding Window Python3 |
👍✅ 单调栈 |
| 240 | Search a 2D Matrix II Medium |
BinarySearch DivideAndConquer Python3 |
👍✅ 单调性扫描 |
| 241 | Different Ways to Add Parentheses Medium |
String Python3 |
递归分治 |
| 242 | Valid Anagram Easy |
String Python3 |
哈希表 |
| 243 | Shortest Word Distance Easy |
Array Python3 |
🔒 模拟数组扫描 模拟优化 |
| 244 | Shortest Word Distance II Medium |
Design HashTable Python3 |
🔒 模拟数组扫描 后处理优化 |
| 245 | Shortest Word Distance III Medium |
Array Python3 |
🔒 模拟数组扫描 后处理优化 特殊条件处理 |
| 246 | Strobogrammatic Number Easy |
Math HashTable Python3 |
🔒 双指针 Hash优化 |
| 247 | Strobogrammatic Number II Medium |
Math Recursion Python3 |
👍🔒 递归解法 迭代解法 |
| 248 | Strobogrammatic Number III Hard |
Math Recursion Python3 |
🔒 递归解法 边界处理 |
| 249 | Group Shifted Strings Medium |
String HashTable Python3 |
👍✅🔒 HashMap巧妙思路 |
| 250 | Count Univalue Subtrees Medium |
BinaryTree Recursion Python3 |
👍✅🔒 自底向上递归 |
| 251 | Flatten 2D Vector Medium |
Design Python3 |
🔒 展成一维存储 行列双变量控制 |
| 252 | Meeting Rooms Easy |
Sort Python3 |
🔒 蛮力(TLE) 排序检查 |
| 253 | Meeting Rooms II Medium |
Sort Greedy Heap Python3 |
👍☑️🔒 最小堆 |
| 254 | Factor Combinations Medium |
BackTracking Python3 |
🔒 自小到大 递归 |
| 255 | Verify Preorder Sequence in Binary Search Tree Medium |
BinarySearchTree Stack Python3 |
👍🔒 出入栈条件 空间优化 |
| 256 | Paint House Easy |
Array DynamicProgramming Python3 |
👍🔒 DP思路 更直观DP |
| 257 | Binary Tree Paths Easy |
BinaryTree DFS Python3 |
DFS 递归 迭代 |
| 258 | Add Digits Easy |
Math Python3 |
模拟 公式法 |
| 259 | 3Sum Smaller Medium |
Array TwoPointers Python3 |
🔒 暴力枚举 双指针 |
| 260 | Single Number III Medium |
HashTable BitManipulation Python3 |
Awesome XOR! |
| 261 | Graph Valid Tree Medium |
Graph UnionFind DFS BFS Python3 |
👍🔒 并查集 |
| 263 | Ugly Number Medium |
Math Python3 |
模拟 |
| 264 | Ugly Number II Medium |
Math Python3 |
👍✅ 三指针法 |
| 265 | Paint House II Hard |
DynamicProgramming Python3 |
👍🔝🔒 DP必刷 |
| 266 | Palindrome Permutation Easy |
String HashTable Python3 |
🔒 Set应用 |
| 267 | Palindrome Permutation II Medium |
String BackTracking Python3 |
👍😍✅🔒 回文串的生成思路 重复回文子串的处理 |
| 268 | Missing Number Easy |
HashTable BitManipulation Python3 |
数学方法 位运算方法 |
| 269 | Alien Dictionary Hard |
Graph TopologicalSort Python3 |
👍😍✅☑️🔒 思路 出入度管理 图的构建 拓扑遍历 必刷好题 |
| 270 | Closest Binary Search Tree Value Easy |
BinarySearch BinarySearchTree Python3 |
🔒 中序查找 二分查找 |
| 271 | Encode and Decode Strings Medium |
String Design Python3 |
🙄🔒 无聊字符串操作 |
| 272 | Closest Binary Search Tree Value II Hard |
BinarySearchTree Stack Python3 |
👍✅🔒 中序遍历更新结果 |
| 273 | Integer to English Words Hard |
String Python3 |
👍✅ 模拟 |
| 274 | H-Index Medium |
HashTable Sort Python3 |
模拟 |
| 275 | H-Index II Medium |
BinarySearch Python3 |
构造二段性 |
| 276 | Paint Fence Easy |
DynamicProgramming Python3 |
👍🔒 数学分析方法 |
| 277 | Find the Celebrity Medium |
Array Python3 |
👍✅🔒 指定API 暴力法 验证法 |
| 278 | First Bad Version Easy |
BinarySearch Python3 |
线性查找超时 折半查找 |
| 279 | Perfect Squares Medium |
Math DynamicProgramming BFS Python3 |
👍✅ DP BFS |
| 280 | Wiggle Sort Medium |
Array Sort Python3 |
🔒 排序交换 遍历规律 |
| 281 | Zigzag Iterator Medium |
Design Python3 |
🔒 保存时处理 访问时处理 |
| 282 | Expression Add Operators Hard |
BackTracking Python3 |
👍✅ DFS+表达式求值 求值时的特殊处理 |
| 283 | Move Zeroes Easy |
TwoPointers Python3 |
遍历并重新赋值 |
| 284 | Peeking Iterator Medium |
Design Python3 |
iterator小改动 |
| 285 | Inorder Successor in BST Medium |
BinarySearchTree Python3 |
👍☑️🔒 迭代中序遍历 |
| 286 | Walls and Gates Medium |
Array BFS Python3 |
:+1::lock: BFS DFS |
| 287 | Find the Duplicate Number Medium |
BinarySearch Python3 |
Counter计数 set去重 👍构造两段性 |
| 288 | Unique Word Abbreviation Medium |
Design HashTable Python3 |
👍🔒 Set与Dict灵活应用 |
| 289 | Game of Life Medium |
Array Python3 |
模拟 Trick |
| 290 | Word Pattern Easy |
String HashTable Python3 |
👍 205题扩展 哈希表映射 |
| 291 | Word Pattern II Hard |
String BackTracking Python3 |
:+1::white_check_mark::lock: 递归回溯 |
| 292 | Nim Game Easy |
Brainteaser Python3 |
水题唬人 |
| 293 | Flip Game Medium |
String BackTracking Minimax Python3 |
🔒 遍历翻转 |
| 294 | Flip Game II Easy |
String Python3 |
🔒 遍历递归判断 |
| 295 | Find Median from Data Stream Hard |
Design Heap Python3 |
👍✅😍 双堆 |
| 296 | Best Meeting Point Hard |
Math Sort Python3 |
👍🔒 排序隐性考察 |
| 297 | Serialize and Deserialize Binary Tree Hard |
BinaryTree Python3 |
👍 递归DFS |
| 298 | Binary Tree Longest Consecutive Sequence Medium |
BinaryTree Python3 |
👍🔒 中序遍历 栈的应用 |
| 299 | Bulls and Cows Easy |
String HashTable Python3 |
👍🔒 哈希表灵活应用 |
| 300 | Longest Increasing Subsequence Medium |
DynamicProgramming Python3 |
DP与优化 |
| 301 | Remove Invalid Parentheses Hard |
BackTracking Python3 |
👍 DFS+括号序列 |
| 302 | Smallest Rectangle Enclosing Black Pixels Hard |
Array BinarySearch Python3 |
:+1::white_check_mark::lock: 原始线性搜索 二分搜索 |
| 303 | Range Sum Query - Immutable Easy |
Array DynamicProgramming Python3 |
前缀和数组 |
| 304 | Range Sum Query 2D - Immutable Medium |
Array DynamicProgramming Python3 |
:+1::white_check_mark: 二维前缀和数组 |
| 305 | Number of Islands II Hard |
UnionFind Python3 |
:+1::white_check_mark::lock: BFS UFS 二维转化一维 |
| 306 | Additive Number Medium |
BackTracking Python3 |
递归模拟 长度限制 |
| 307 | Range Sum Query - Mutable Medium |
BinaryIndexTree SegmentTree Python3 |
树状数组 |
| 308 | Range Sum Query 2D - Mutable Hard |
BinaryIndexTree SegmentTree Python3 |
👍✅🔒 行之和 前缀数组 |
| 309 | Best Time to Buy and Sell Stock with Cooldown Medium |
DynamicProgramming Python3 |
👍✅ 带约束DP |
| 310 | Minimum Height Trees Medium |
BFS Graph Python3 |
|
| 311 | Sparse Matrix Multiplication Medium |
Array HashTable Python3 |
🔒 非0才相乘 |
| 312 | Burst Balloons Hard |
DynamicProgramming Python3 |
👍 FunnyDPQuestion |
| 313 | Super Ugly Number Medium |
Math Heap Python3 |
👍 模拟 264扩展 |
| 314 | Binary Tree Vertical Order Traversal Medium |
BinaryTree HashTable Python3 |
👍🔒 层序遍历 横向排序 |
| 315 | Count of Smaller Numbers After Self Hard |
BinarySearch DivideAndConquer Sort BinaryIndexTree SegmentTree Python3 |
|
| 317 | Shortest Distance from All Buildings Hard |
Array BFS DFS Python3 |
👍✅🔒 BFS 多变量更新 |
| 319 | Bulb Switcher Medium |
Math BrainTeaser Python3 |
👍 数论 |
| 320 | Generalized Abbreviation Medium |
String BackTracking BitManipulation Python3 |
👍✅🔒 递归回溯 位运算Trick |
| 322 | Coin Change Medium |
DynamicProgramming Python3 |
DP完全背包 |
| 323 | Number of Connected Components in an Undirected Graph Medium |
UnionFind Graph DFS BFS Python3 |
👍✅🔒 简单UFS 路径压缩 Rank合并 |
| 324 | Wiggle Sort II Medium |
Sort Python3 |
☑️排序规律划分 Follow Up(TODO) |
| 325 | Maximum Size Subarray Sum Equals k Medium |
Array HashTable Python3 |
👍✅🔒 前缀和数组 保存出现最早位置 Trick |
| 326 | Power of Three Easy |
Math BitManipulation Python3 |
基本数学 数论 log逆运算 |
| 328 | Odd Even Linked List Medium |
LinkedList Python3 |
👍✅ 指针拆分 Dummy Node |
| 329 | Longest Increasing Path in a Matrix Hard |
Memorization Python3 |
DFS |
| 331 | Verify Preorder Serialization of a Binary Tree Medium |
BinaryTree Python3 |
入度出度之差 砍叶子:fallen_leaf: |
| 332 | Reconstruct Itinerary Medium |
Graph DFS Python3 |
👍🔝☑️ 贪心回溯 Hierholzer's Algorithm |
| 333 | Largest BST Subtree Medium |
BinaryTree BinarySearchTree Python3 |
👍✅🔒 自底向上 |
| 336 | Palindrome Pairs Hard |
HashTable String Trie Python3 |
找规律 哈希 |
| 337 | House Robber III Medium |
BinaryTree DynamicProgramming Python3 |
👍✅ 树形DP |
| 338 | Counting Bits Medium |
DynamicProgramming BitManipulation Python3 |
👍✅ DP Most Significant Least Significant |
| 339 | Nested List Weight Sum Easy |
Array DFS Python3 |
👍🔒 DFS |
| 340 | Longest Substring with At Most K Distinct Characters Hard |
String HashTable SlidingWindow Python3 |
👍🔒 滑动窗口 159题扩展 |
| 341 | Flatten Nested List Iterator Medium |
Stack Design Python3 |
👍 队列迭代 DFS预处理 |
| 342 | Power of Four Easy |
Math BitManipulation Python3 |
基本数学 位运算 数论 |
| 343 | Integer Break Medium |
Math DynamicProgramming Python3 |
👍 DP 数学 |
| 344 | Reverse String Easy |
String TwoPointers Python3 |
两端双指针 |
| 345 | Reverse Vowels of a String Easy |
String TwoPointers Python3 |
两端过滤双指针 记录逆序替换 |
| 346 | Moving Average from Data Stream Easy |
Design Queue Python3 |
🔒 队列 数满则溢 |
| 347 | Top K Frequent Elements Medium |
Stack PriorityQueue Python3 |
Counter计数 桶排序 |
| 348 | Design Tic-Tac-Toe Medium |
Design Python3 |
👍✅🔒 直观Grid 伴随统计 |
| 349 | Intersection of Two Arrays Easy |
Array HashTable TwoPointers BinarySearch Sort Python3 |
暴力统计 字典求解 |
| 350 | Intersection of Two Arrays II Easy |
Array HashTable TwoPointers BinarySearch Sort Python3 |
字典哈希 |
| 351 | Android Unlock Patterns Medium |
Array BackTracking DynamicProgramming Python3 |
👍☑️🔒 递归回溯 对称性 |
| 352 | Data Stream as Disjoint Intervals Hard |
UnionFind BinarySearch OrderedMap Python3 |
👍☑️ 并查集 |
| 353 | Design Snake Game Hard |
Design Python3 |
👍🔒 模拟 Deque应用 |
| 354 | Russian Doll Envelopes Hard |
DynamicProgramming BinarySearch Python3 |
👍☑️ 常规DP DP优化 |
| 355 | Design Twitter Easy |
Design HashTable Heap Python3 |
👍☑️ |
| 356 | Line Reflection Medium |
Array Math HashTable Python3 |
👍🔒 找中心 判对称 |
| 358 | Rearrange String k Distance Apart Hard |
String Heap Greedy Python3 |
👍✅🔒 贪心 最高频率分桶 |
| 359 | Logger Rate Limiter Easy |
Design HashTable Python3 |
🔒 哈希表简单应用 |
| 360 | Sort Transformed Array Medium |
Array Math TwoPointers Sort Python3 |
👍🔒 蛮力 双指针 |
| 361 | Bomb Enemy Medium |
Array DynamicProgramming Python3 |
👍✅🔒 BruteForce DP |
| 362 | Design Hit Counter Medium |
Design Python3 |
👍🔒 Deque应用 空间换时间 |
| 363 | Max Sum of Rectangle No Larger Than K Hard |
BinarySearch DynamicProgramming Queue Python3 |
😢👍☑️ 枚举 前缀和优化 Kadane算法 二分优化 |
| 364 | Nested List Weight Sum II Medium |
Array DFS Python3 |
👍✅🔒 统计层序和再逆序求和 |
| 366 | Find Leaves of Binary Tree Medium |
BinaryTree DFS Python3 |
👍🔒 递归后序 深度扩展 |
| 367 | Valid Perfect Square Easy |
BinarySearch Math Python3 |
|
| 368 | Largest Divisible Subset Medium |
Math DynamicProgramming Python3 |
规律DP |
| 369 | Plus One Linked List Medium |
LinkedList Python3 |
👍✅🔒 两次翻转 Trick |
| 370 | Range Addition Medium |
Array Math Python3 |
👍✅🔒 RangeCaching Trick |
| 371 | Sum of Two Integers Easy |
BitManipulation Python3 |
👍🔝 位运算 |
| 374 | Guess Number Higher or Lower Easy |
BinarySearch Python3 |
折半查找 |
| 375 | Guess Number Higher or Lower II Medium |
DynamicProgramming Python3 |
DP+MiniMax |
| 376 | Wiggle Subsequence Medium |
DynamicProgramming Greedy Python3 |
|
| 378 | Kth Smallest Element in a Sorted Matrix Medium |
Matrix Python3 |
Counter或桶排序 |
| 379 | Design Phone Directory Medium |
Design LinkedList Python3 |
🔒 |
| 380 | Insert Delete GetRandom O(1) Medium |
Design Array HashTable Python3 |
👍 dict+list Trick |
| 382 | Linked List Random Node Medium |
ReservoirSampling Python3 |
Two Pass 蓄水池采样 |
| 383 | Ransom Note Easy |
String Python3 |
模拟 哈希表 |
| 384 | Shuffle an Array Medium |
Random Python3 |
random互换 |
| 387 | First Unique Character in a String Easy |
String HashTable Python3 |
哈希模拟 |
| 389 | Find the Difference Easy |
HashTable BitManipulation Python3 |
|
| 392 | Is Subsequence Easy |
String HashTable Greedy BinarySearch Python3 |
👍🔝 哈希速度优化 二分 |
| 394 | Decode String Medium |
Stack DFS Python3 |
👍✅ 递归 栈 |
| 399 | Evaluate Division Medium |
UnionFind Graph Python3 |
哈希模拟 并查集 |
| 401 | Binary Watch Easy |
BackTracking BitManipulation Python3 |
遍历count验证 |
| 402 | Remove K Digits Medium |
Greedy Python3 |
栈的应用 |
| 405 | Convert a Number to Hexadecimal Easy |
BitManipulation Python3 |
特殊处理负数 |
| 406 | Queue Reconstruction by Height Medium |
Greedy Python3 |
👍 贪心性质发现 模拟 |
| 407 | Trapping Rain Water II Hard |
Heap BFS Python3 |
👍✅ BFS |
| 408 | Valid Word Abbreviation Easy |
String Python3 |
🔒 双指针 字符数字分别处理 |
| 409 | Longest Palindrome Easy |
HashTable Python3 |
奇偶分别考虑 |
| 410 | Split Array Largest Sum Hard |
BinarySearch DynamicProgramming Python3 |
👍 二分贪心 DP |
| 411 | Minimum Unique Word Abbreviation Hard |
BackTracking BitManipulation Python3 |
👍🔝☑️🔒 边缩写边检查 Abbreviation综合考察 |
| 412 | Fizz Buzz Easy |
String Python3 |
简单明了 |
| 414 | Third Maximum Number Easy |
Array Sort Python3 |
三变量更新 |
| 415 | Add Strings Easy |
String Python3 |
模拟 |
| 416 | Partition Equal Subset Sum Medium |
DynamicProgramming Python3 |
包装01背包问题 空间优化 |
| 418 | Sentence Screen Fitting Medium |
Array DynamicProgramming Python3 |
👍✅🔒 建表查表 冲突回滚 |
| 421 | Maximum XOR of Two Numbers in an Array Medium |
BitManipulation Trie Python3 |
👍🔝😍 位前缀哈希 Trie树 |
| 422 | Valid Word Square Easy |
Array String Math Python3 |
🔒 越界判断 对应比较 |
| 425 | Word Squares Hard |
String BackTracking Trie Python3 |
:+1::top::white_check_mark::lock: 前缀字典 前缀树经典应用 |
| 426 | Convert Binary Search Tree to Sorted Doubly Linked List Medium |
BinarySearchTree LinkedList DivideAndConquer Python3 |
👍🔒 中序递归 InPlace |
| 428 | Serialize and Deserialize N-ary Tree Hard |
Tree String Python3 |
:+1::top::ballot_box_with_check::lock: 先序递归遍历 |
| 429 | N-ary Tree Level Order Traversal Medium |
Tree BFS Python3 |
BFS extend |
| 430 | Flatten a Multilevel Doubly Linked List Medium |
LinkedList DFS Python3 |
👍 迭代DFS |
| 431 | Encode N-ary Tree to Binary Tree Hard |
BinaryTree Python3 |
👍🔒 N-ary to Binary |
| 438 | Find All Anagrams in a String Medium |
HashTable Python3 |
哈希表 滑动窗口 |
| 439 | Ternary Expression Parser Medium |
String Stack DFS Python3 |
:+1::lock: 自右向左处理 |
| 441 | Arranging Coins Easy |
BinarySearch Math Python3 |
:+1::ballot_box_with_check: 模拟 数学推导 二分查找 |
| 444 | Sequence Reconstruction Medium |
String Graph TopologicalSort Python3 |
:+1::white_check_mark::lock: 相邻顺序对应 记录已出现 枚举判断 |
| 447 | Number of Boomerangs Easy |
HashTable Math Python3 |
:+1: 距离相等点+1 组合数+2 |
| 451 | Sort Characters By Frequency Medium |
HashTable Heap Python3 |
哈希+heapq |
| 452 | Minimum Number of Arrows to Burst Balloons Medium |
Greedy Python3 |
👍 排序贪心 |
| 454 | 4Sum II Easy |
Array HashTable BinarySearch Python3 |
👍✅ 哈希转化 |
| 455 | Assign Cookies Easy |
Greedy Python3 |
贪心 |
| 456 | 132 Pattern Medium(Hard) |
Array Stack Python3 |
👍✅ 单调栈扩展 |
| 458 | Poor Pigs Hard |
Math Brainteaser Python3 |
👍 数学分析 找规律 |
| 461 | Hamming Distance Easy |
BitManipulation Python3 |
Brian Kernighan's Algorithm |
| 462 | Minimum Moves to Equal Array Elements II Medium |
Math Python3 |
分奇偶找中值 |
| 463 | Island Perimeter Easy |
HashTable Python3 |
模拟 memo思想 |
| 464 | Can I Win Medium |
DynamicProgramming Minimax Python3 |
👍🔝 Minimax博弈 记忆化递归 |
| 465 | Optimal Account Balancing Hard |
Array Math Python3 |
👍🔝✅🔒 哈希表 集合 DFS 综合应用 |
| 468 | Validate IP Address Medium |
String Python3 |
模拟 Regex |
| 469 | Convex Polygon Medium |
Array Math Python3 |
👍✅🔒 凸多边形性质 叉乘应用 |
| 470 | Implement Rand10() Using Rand7() Medium |
RejectionSampling Python3 |
|
| 471 | Encode String with Shortest Length Hard |
String>br>DynamicProgramming Python3 |
👍🔝🔒 二维DP |
| 473 | Matchsticks to Square Medium |
BackTracking Python3 |
DFS 长者为先 |
| 475 | Heaters Easy |
Array BinarySearch Python3 |
贪心法 二分法 |
| 476 | Number Complement Easy |
BitManipulation Python3 |
模拟 位运算规律 |
| 477 | Total Hamming Distance Medium |
BitManipulation Python3 |
按位统计 |
| 481 | Magical String Medium |
String Python3 |
👍规律模拟 |
| 482 | License Key Formatting Easy |
String Python3 |
字符串基础操作 模拟 |
| 484 | Find Permutation Medium |
Greedy Python3 |
👍🔒 贪心栈 |
| 485 | Max Consecutive Ones Easy |
Array Python3 |
水题 |
| 486 | Predict the Winner Medium |
DynamicProgramming MiniMax Python3 |
DP |
| 487 | Max Consecutive Ones II Medium |
TwoPointers SlidingWindow Python3 |
🔒 分两段 滑动窗口 流式记录 |
| 489 | Robot Room Cleaner Medium |
DFS BackTracking Python3 |
🔒 DFS回溯 |
| 490 | The Maze Medium |
Arrays DFS BFS Python3 |
👍✅🔒 DFS |
| 496 | Next Greater Element I Easy |
Stack Python3 |
遍历查找 单调栈与hashmap |
| 499 | The Maze III Hard |
Array DFS BFS Python3 |
👍✅🔒 DFS |
| 500 | Keyboard Row Easy |
Math HashTable Python3 |
字符串in操作 集合元素求交集 |
| 501 | Find Mode in Binary Search Tree Easy |
BinarySearchTree Python3 |
中序遍历 遍历查相邻 |
| 503 | Next Greater Element II Medium |
Stack Python3 |
遍历查找(TLE) 单调栈 |
| 504 | Base 7 Easy |
Math Python3 |
Flag and Mod |
| 505 | The Maze II Medium |
Array DFS BFS Python3 |
👍✅🔒 DFS |
| 506 | Relative Ranks Easy |
Array Sort HashTable Python3 |
排序查表 |
| 507 | Perfect Number Easy |
Math Python3 |
👍 暴力枚举 枚举优化 |
| 509 | Fibonacci Number Easy |
Array Math Python3 |
👍🔝 原始递归 尾递归 DP循环 空间优化 |
| 510 | Inorder Successor in BST II Medium |
BinarySearchTree Python3 |
👍🔒 分情况讨论 右分支有无 |
| 513 | Find Bottom Left Tree Value Medium |
BinaryTree DFS BFS Python3 |
模拟层序遍历 |
| 518 | Coin Change 2 Medium |
DynamicProgramming Python3 |
👍 二维DP 一维DP |
| 520 | Detect Capital Easy |
String Python3 |
字符串基本函数 |
| 521 | Longest Uncommon Subsequence II Easy |
String Python3 |
BrainTeaser |
| 525 | Contiguous Array Medium |
Array HashTable Python3 |
👍 前缀和 + 哈希表转化 |
| 526 | Beautiful Arrangement Medium |
BackTracking Python3 |
☑️ 回溯 |
| 527 | Word Abbreviation Hard |
String Sort Python3 |
👍✅🔒 规则分桶 LCP求解 消除冲突 |
| 528 | Random Pick with Weight Medium |
Design BinarySearch Random Python3 |
问题建模 |
| 530 | Minimum Absolute Difference in BST Easy |
BinaryTree Python3 |
中序遍历 有序数组中找最小差值 |
| 531 | Lonely Pixel I Medium |
Array DFS Python3 |
👍🔒 两次遍历 |
| 532 | K-diff Pairs in an Array Easy |
Array TwoPointers Python3 |
统计数频 特判k为0 |
| 533 | Lonely Pixel II Medium |
Array DFS Python3 |
🔒 |
| 540 | Single Element in a Sorted Array Medium |
Array Python3 |
位运算 折半查找 |
| 541 | Reverse String II Easy |
String TwoPointers Python3 |
分段处理 两端双指针 |
| 542 | 01 Matrix Medium |
DFS BFS Python3 |
👍✅ 蛮力(TLE) BFS DP |
| 543 | Diameter of Binary Tree Easy |
BinaryTree Python3 |
DFS |
| 544 | Output Contest Matches Medium |
Array Half-Fold Python3 |
🔒 折半两端匹配 |
| 545 | Boundary of Binary Tree Medium |
BinaryTree Python3 |
👍☑️🔒 分部处理 左右逆序 |
| 547 | Friend Circles Medium |
UnionFind DFS Python3 |
👍 并查集入门题 |
| 548 | Split Array with Equal Sum Medium |
Array Math Python3 |
👍🔝✅🔒 贪心 前缀和 HashTable优化 中点分两段 |
| 551 | Student Attendance Record I Easy |
String Python3 |
模拟 |
| 554 | Brick Wall Medium |
Array HashTable Python3 |
👍✅ 贪心+哈希表 |
| 555 | Split Concatenated Strings Medium |
String Python3 |
枚举 高位优先优化 |
| 556 | Next Greater Element III Medium |
String Math Python3 |
👍✅ 找规律 |
| 560 | Subarray Sum Equals K Medium |
Array HashTable Python3 |
前缀和 + 哈希表 |
| 567 | Permutation in String Medium |
TwoPointers SlidingWindow Python3 |
滑动窗口 |
| 572 | Subtree of Another Tree Easy |
BinaryTree Python3 |
递归先序 模拟比较 |
| 582 | Kill Process Medium |
BinaryTree Queue Python3 |
👍🔒 字典记录父子关系 队列实现逐层杀死 |
| 583 | Delete Operation for Two Strings Medium |
String Python3 |
👍✅ 双DP LCS Edit Distance |
| 588 | Design In-Memory File System Hard |
Design Python3 |
👍🔒 分别处理文件与文件夹 |
| 604 | Design Compressed String Iterator Easy |
Design String Python3 |
✅🔒 Demand-Computation |
| 611 | Image Smoother Easy |
Array Python3 |
依题意操作 |
| 616 | Add Bold Tag in String Medium |
String Python3 |
🔒 Bold Flag 与758题雷同 |
| 624 | Maximum Distance in Arrays Easy |
Array HashTable Python3 |
🔒 |
| 625 | Minimum Factorization Medium |
Math Recursion Python3 |
🔒 贪心因式分解 |
| 634 | Find the Derangement of An Array Medium |
Math Python3 |
:lock: DP 组合错排问题 空间优化 |
| 635 | Design Log Storage System Medium |
String Design Python3 |
👍🔒 提取比较 |
| 643 | Maximum Average Subarray I Easy |
Array Math Python3 |
遍历更新 |
| 644 | Maximum Average Subarray II Hard |
Array Math BinarySearch Python3 |
👍🔝✅🔒 蛮力TLE 折半查找 滑动窗口 |
| 650 | 2 Keys Keyboard Medium |
DynamicProgramming Python3 |
👍 DP 递归 数学 |
| 652 | Find Duplicate Subtrees Medium |
BinaryTree Python3 |
👍DFS 哈希 关注局部 |
| 653 | Two Sum IV - Input is a BST Easy |
BinarySearchTree Python3 |
中序遍历 已排序数组两数之和为target |
| 657 | Robot Return to Origin Easy |
String Python3 |
抵消count 模拟 |
| 658 | Find K Closest Elements Medium |
BinarySearch Python3 |
👍✅ 排序 双指针 二分查找 |
| 662 | Maximum Width of Binary Tree Medium |
BinaryTree Python3 |
👍✊ BFS DFS |
| 664 | Strange Printer Hard |
DynamicProgramming DFS Python3 |
👍✅ DP进阶题目 |
| 681 | Next Closest Time Hard |
String Python3 |
🔒 模拟 |
| 684 | Redundant Connection Medium |
Tree UnionFind Graph Python3 |
👍 并查集 |
| 687 | Longest Univalue Path Easy |
Recursion Python3 |
DFS递归 |
| 692 | Top K Frequent Words Medium |
Array HashTable Heap Trie Python3 |
👍✅ 优先队列改造题 |
| 695 | Max Area of Island Medium |
Array DFS BFS Python3 |
递归DFS 队列BFS |
| 697 | Degree of an Array Easy |
Array Python3 |
统计查表 |
| 700 | Search in a Binary Search Tree Easy |
BinarySearchTree Python3 |
递归 迭代 |
| 703 | Kth Largest Element in a Stream Easy |
Heap Python3 |
维护k个元素的最小堆 |
| 704 | Binary Search Easy |
BinarySearch Python3 |
依题意 |
| 705 | Design HashSet Easy |
HashTable Design Python3 |
数组模拟 |
| 706 | Design HashMap Easy |
HashTable Design Python3 |
数组模拟 |
| 716 | Max Stack Easy |
Stack Design Python3 |
👍🔒 双栈模拟 |
| 728 | Self Dividing Numbers Easy |
Math Python3 |
模拟 |
| 729 | My Calendar I Medium |
Array Python3 |
蛮力 Need Imporve |
| 731 | My Calendar II Medium |
OrderedMap Python3 |
👍 729再重叠 |
| 733 | Flood Fill Easy |
DFS BFS Python3 |
队列BFS 递归DFS |
| 734 | Sentence Similarity Easy |
String HashTable Python3 |
🔒 Tuple与Set |
| 737 | Sentence Similarity II Medium |
String DFS UnionFind Python3 |
👍🔒 并查集 |
| 743 | Network Delay Time Medium |
Heap DFS BFS Graph Python3 |
☑️ Dijkstra算法 Bellman-Ford算法 |
| 746 | Min Cost Climbing Stairs Easy |
Array DynamicProgramming Python3 |
👍 70题扩展 两种DP |
| 751 | IP to CIDR Easy |
Greedy BitManipulation Python3 |
👍🔒 贪心最大块 位运算查找 |
| 755 | Pour Water Medium |
Array Simulation Python3 |
🔒 模拟流动 左边优先 |
| 756 | Pyramid Transition Matrix Medium |
BitManipulation DFS Python3 |
👍 模拟 DFS&BFS |
| 758 | Bold Words in String Easy |
String Python3 |
👍🔒 Bold Flag |
| 762 | Prime Number of Set Bits in Binary Representation Easy |
BitManipulation Python3 |
👍 枚举 位运算技巧 |
| 771 | Jewels and Stones Easy |
String Python3 |
水题 |
| 777 | Swap Adjacent in LR String Medium |
Brainteaser Python3 |
👍✅ 找规律 Funny |
| 784 | Letter Case Permutation Easy |
BackTracking BitManipulation Python3 |
DFS |
| 785 | Is Graph Bipartite? Medium |
Graph DFS BFS Python3 |
DFS模拟 |
| 787 | Cheapest Flights Within K Stops Medium |
DFS BFS Python3 |
👍☑️ 数值引用传递 |
| 800 | Similar RGB Color Easy |
String Math Python3 |
🔒 蛮力求解 数学分析 |
| 809 | Expressive Words Medium |
String Python3 |
模拟 分段核对 |
| 829 | Consecutive Numbers Sum Hard |
Math Python3 |
👍 数学分析 等差数列求和 |
| 840 | Magic Squares In Grid Easy |
Array Python3 |
枚举检查 |
| 843 | Guess the Word Hard |
Minimax Python3 |
👍 交互问题 |
| 846 | Hand of Straights Easy |
Heap Python3 |
Counter应用 |
| 849 | Maximize Distance to Closest Person Easy |
Array Python3 |
滑动窗口 两侧特殊处理 |
| 852 | Peak Index in a Mountain Array Easy |
Array BinarySearch Python3 |
线性 折半 |
| 857 | Minimum Cost to Hire K Workers Hard |
Heap Python3 |
👍✅🔝 贪心最大堆 |
| 860 | Lemonade Change Easy |
Greedy Python3 |
贪心 |
| 883 | Projection Area of 3D Shapes Medium |
Array Math Python3 |
规律计算 |
| 886 | Possible Bipartition Medium |
DFS Python3 |
建图+785 |
| 891 | Sum of Subsequence Widths Hard |
Array Math Python3 |
👍 数学规律 |
| 892 | Surface Area of 3D Shapes Easy |
Math Geometry Python3 |
找规律问题 |
| 901 | Online Stock Span Medium |
Stack Python3 |
蛮力算法 栈记忆 |
| 904 | Fruit Into Baskets Medium |
TwoPointers Python3 |
滑动窗口 159题包装 |
| 918 | Maximum Sum Circular Subarray Medium(Hard) |
Array Python3 |
👍✅ 前缀和单调队列 分情况讨论 |
| 929 | Unique Email Addresses Easy |
String Python3 |
哈希表 字符串处理 |
| 930 | Binary Subarrays With Sum Medium |
HashTable TwoPointers Python3 |
👍☑️🔝 记录基本元素位置 前缀和+counts |
| 933 | Number of Recent Calls Easy |
Queue Python3 |
二分查找 队列 |
| 957 | Prison Cells After N Days Medium |
HashTable Python3 |
大数模拟 必有循环 |
| 973 | K Closest Points to Origin Medium |
DivideAndConquer Heap Sort Python3 |
👍☑️ 调库 分治 最小堆 |
| 975 | Odd Even Jump Hard |
DynamicProgramming Stack OrderedMap Python3 |
👍☑️ 单调栈 记忆化递归 |
| 986 | Interval List Intersections Medium |
TwoPointers Python3 |
✅ 双指针 |
| 989 | Add to Array-Form of Integer Easy |
Array Python3 |
逐位相加进位 |
| 993 | Cousins in Binary Tree Easy |
BinaryTree Python3 |
DFS或BFS预处理 |
| 997 | Find the Town Judge Easy |
Graph Python3 |
集合模拟 出入度 |
| 999 | Available Captures for Rook Easy |
Array Python3 |
暴力枚举 |
| 1002 | Find Common Characters Easy |
Array HashTable Python3 |
小根堆 |
| 1004 | Max Consecutive Ones III Medium |
TwoPointers SlidingWindow Python3 |
滑动窗口 |
| 1005 | Maximize Sum Of Array After K Negations Easy |
Greedy Python3 |
小根堆 |
| 1006 | Clumsy Factorial Medium |
Math Python3 |
直接计算 eval函数 |
| 1008 | Construct Binary Search Tree from Preorder Traversal Medium |
BinaryTree Python3 |
递归 |
| 1009 | Complement of Base 10 Integer Easy |
Math Python3 |
进制转化 |
| 1010 | Pairs of Songs With Total Durations Divisible by 60 Easy |
Math Array Python3 |
统计频次 组合计算 |
| 1011 | Capacity To Ship Packages Within D Days Medium |
Array BinarySearch Python3 |
二分 模拟 |
| 1013 | Partition Array Into Three Parts With Equal Sum Easy |
Array Python3 |
线性扫描 |
| 1014 | Best Sightseeing Pair Medium |
Array Python3 |
线性扫描 |
| 1015 | Smallest Integer Divisible by K Medium |
Math Python3 |
暴力枚举 |
| 1016 | Binary String With Substrings Representing 1 To N Medium |
String Python3 |
子串枚举 |
| 1021 | Remove Outermost Parentheses Easy |
String Stack Python3 |
栈 |
| 1022 | Sum of Root To Leaf Binary Numbers Easy |
BinaryTree Python3 |
👍 DFS |
| 1023 | Camelcase Matching Medium |
String Trie Python3 |
直接查找 + 检查 |
| 1025 | Divisor Game Easy |
Math DynamicProgramming Python3 |
数学推导 |
| 1026 | Maximum Difference Between Node and Ancestor Medium |
BinaryTree DFS Python3 |
DFS |
| 1029 | Two City Scheduling Easy |
Greedy Python3 |
排序贪心 |
| 1035 | Uncrossed Lines Medium |
Array Python3 |
DP基础题 |
| 1044 | Longest Duplicate Substring Hard |
HashTable BinarySearch Python3 |
☑️ Rabin-Karp 1062扩展 |
| 1056 | Confusing Number Easy |
Math Python3 |
🔒 记录翻转对 注意拼接顺序 |
| 1062 | Longest Repeating Substring Medium |
String BinarySearch Python3 |
☑️ Set Hash Rabin-Karp |
| 1064 | Fixed Point Easy |
Array BinarySearch Python3 |
🔒 水题 |
| 1065 | Index Pairs of a String Easy |
String Trie Python3 |
🔒 查找排序 |
| 1085 | Sum of Digits in the Minimum Number Easy |
Array Python3 |
🔒 模拟 |
| 1086 | High Five Easy |
Array HashTable Sort Heap Python3 |
🔒 大根堆 |
| 1099 | Two Sum Less Than K Easy |
Array Python3 |
🔒 双指针 |
| 1103 | Distribute Candies to People Easy |
Math Python3 |
👍 模拟 数学推导 |
| 1118 | Number of Days in a Month Easy |
HashTable Python3 |
🔒 分闰平 |
| 1119 | Remove Vowels from a String Easy |
String Python3 |
🔒 字符串基本操作 |
| 1133 | Largest Unique Number Easy |
Array HashTable Python3 |
👍🔒 字典 调库 排序过滤 |
| 1134 | Armstrong Number Easy |
Math Python3 |
🔒 水题 |
| 1135 | Connecting Cities With Minimum Cost Medium |
UnionFind Graph Python3 |
最小生成树 Kruskal算法 Prim算法 |
| 1137 | N-th Tribonacci Number Easy |
Math Recursion Python3 |
👍✅🔒 DP 记忆递归 记忆DP |
| 1140 | Stone Game II Medium |
DynamicProgramming Python3 |
☑️ DP |
| 1143 | Longest Common Subsequence Medium |
DynamicProgramming Python3 |
二维DP |
| 1150 | Check If a Number Is Majority Element in a Sorted Array Easy |
Array BinarySearch Python3 |
🔒 水题 |
| 1154 | Day of the Year Easy |
Math Python3 |
分段处理 特判闰年 |
| 1165 | Single-Row Keyboard Easy |
String Python3 |
🔒 记录下标 遍历统计 |
| 1169 | Invalid Transactions Medium |
Array String Python3 |
蛮力模拟 👍分组排序过滤 |
| 1175 | Prime Arrangements Easy |
Math Python3 |
👍✅🔝 暴力法求质数 欧拉筛法求质数 |
| 1176 | Diet Plan Performance Easy |
Array SlidingWindow Python3 |
🔒 滑动窗口 |
| 1180 | Count Substrings with Only One Distinct Letter Easy |
Math String Python3 |
🔒 组合数 找规律 |
| 1184 | Distance Between Bus Stops Easy |
Array Python3 |
模拟 |
| 1185 | Day of the Week Easy |
Array Python3 |
形参同名问题 |
| 1189 | Maximum Number of Balloons Easy |
HashTable String Python3 |
计数看瓶颈 |
| 1196 | How Many Apples Can You Put into the Basket Easy |
Array Greedy Python3 |
🔒 轻者优先 |
| 1197 | Minimum Knight Moves Medium |
DFS BFS Python3 |
🔒👍 普通BFS 对称优化BFS |
| 1200 | Minimum Absolute Difference Easy |
Array Python3 |
🔒 相邻差最小 |
| 1207 | Unique Number of Occurrences Easy |
HashTable Python3 |
统计核对 |
| 1213 | Intersection of Three Sorted Arrays Easy |
Array HashTable TwoPointers Python3 |
🔒 Set交集 Counter计数 三指针 |
| 1215 | Stepping Numbers Medium |
BackTracking Python3 |
🔒🔝✅ 模拟 DFS BFS |
| 1227 | Airplane Seat Assignment Probability Medium |
Math DynamicProgramming Brainteaser Python3 |
👍✅ DP推导 数学证明 |
| 1228 | Missing Number In Arithmetic Progression Easy |
Array Math Python3 |
🔒 找出差 逐个核查 |
| 1229 | Meeting Scheduler Medium |
Array LineSweep Python3 |
🔒 贪心双指针 |
| 1232 | Check If It Is a Straight Line Easy |
Array Math Geometry Python3 |
👍斜率公式转化 |
| 1236 | Web Crawler Medium |
HashTable DFS BFS Python3 |
👍🔒 DFS遍历 Set去重 |
| 1243 | Array Transformation Easy |
Array Python3 |
🔒 模拟 |
| 1244 | Design A Leaderboard Medium |
HashTable Sort Design Python3 |
🔒 基础 |
| 1245 | Tree Diameter Medium |
Tree DFS BFS Python3 |
😍🔒 建图 DFS |
| 1247 | Minimum Swaps to Make Strings Equal Medium |
String Greedy Python3 |
找规律 贪心 |
| 1256 | Encode Number Medium |
Math BitManipulation Python3 |
🔒 找规律 |
| 1266 | Minimum Time Visiting All Points Easy |
Array Geometry Python3 |
画图规律遍历 |
| 1267 | Count Servers that Communicate Medium |
Array Graph Python3 |
枚举置位统计 |
| 1271 | Hexspeak Easy |
Math String Python3 |
🔒 模拟 |
| 1272 | Remove Interval Medium |
Math LineSweep Python3 |
🔒 模拟 |
| 1276 | Number of Burgers with No Waste of Ingredients Medium |
Math Greedy Python3 |
数学分析模拟 |
| 1277 | Count Square Submatrices with All Ones Medium |
Array DynamicProgramming Python3 |
🔝👍☑️ 动规好题 |
| 1281 | Subtract the Product and Sum of Digits of an Integer Easy |
Math Python3 |
模拟 |
| 1282 | Group the People Given the Group Size They Belong To Medium |
Greedy Python3 |
分组贪心 |
| 1287 | Element Appearing More Than 25% In Sorted Array Easy |
Array Python3 |
模拟 |
| 1290 | Convert Binary Number in a Linked List to Integer Easy |
LinkedList BitManipulation Python3 |
模拟 |
| 1296 | Divide Array in Sets of K Consecutive Numbers Medium |
Array Greedy Python3 |
排序 哈希模拟 |
| 1304 | Find N Unique Integers Sum up to Zero Easy |
Array Python3 |
模拟 |
| 1323 | Maximum 69 Number Easy |
Math Python3 |
基础字符串操作 |
| 1365 | How Many Numbers Are Smaller Than the Current Number Easy |
Array HashTable Python3 |
模拟 分桶前缀和 |
| 1389 | Create Target Array in the Given Order Easy |
Array Python3 |
|
| 1429 | First Unique Number Medium |
HashTable Design Python3 |
hash+deque |
| # | Title | Difficulty | Solution | Notes |
|---|---|---|---|---|
| 175 | Combine Two Tables | Easy | SQL | left join |
| 176 | Second Highest Salary | Easy | SQL | IFNULL Count |
| # | Title | Difficulty | Solution | Notes |
|---|---|---|---|---|
| 192 | Word Frequency | Easy | Shell | 👍 |
| 195 | Tenth Line | Easy | Shell | sed awk head tail |
| # | Title | Difficulty | Solution | Notes |
|---|---|---|---|---|
| 1114 | Print in Order | Easy | Python3 | acquire release |
| 1279 | Traffic Light Controlled Intersection | Easy | Python3 | Lock BoundedSemaphore |
Welcome to raise an issue here if you have any feedback.