# nowCoder **Repository Path**: XrazYang/nowcoder ## Basic Information - **Project Name**: nowCoder - **Description**: LeetCode 新手村... - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2023-07-04 - **Last Updated**: 2025-04-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: LeetCode, Java ## README # LeetCode 新手村 刷题参考资料: 1. [耗子叔leetcode刷题记录](https://github.com/haoel/leetcode) 2. [从零开始的力扣刷题生活](https://leetcode.cn/circle/discuss/E3yavq) ---- ## 基础题专题 ### 一. 数组篇 #### 1. 数组算法 | # | Title | Solution | Difficulty | |:---:|:----------------------------------------------------------------------------|:--------:|:----------:| | 13 | [Roman to Integer](https://leetcode.cn/problems/roman-to-integer) | ✔ | Easy | | 58 | [Length of Last Word](https://leetcode.cn/problems/length-of-last-word) | ✔ | Easy | | 137 | [Single Number II](https://leetcode.cn/problems/single-number-ii) | ✔ | Easy | | 149 | [Max Points on a Line](https://leetcode.cn/problems/max-points-on-a-line) | ✔ | Hard | | 169 | [Majority Element](https://leetcode.cn/problems/majority-element) | ✔ | Easy | | 189 | [Rotate Array](https://leetcode.cn/problems/rotate-array) | ✔ | Medium | | 219 | [Contains Duplicate II](https://leetcode.cn/problems/contains-duplicate-ii) | ✔ | Easy | ---- ### 二. 数与位运算篇 #### 1. 位运算的基本运算 | # | Title | Solution | Difficulty | |:---:|:------------------------------------------------------------------------------------------|:--------:|:----------:| | 136 | [Single Number](https://leetcode.cn/problems/single-number) | ✔ | Easy | | 190 | [Reverse Bits](https://leetcode.cn/problems/reverse-bits) | ✔ | Easy | | 191 | [Number of 1 Bits](https://leetcode.cn/problems/number-of-1-bits) | ✔ | Easy | | 201 | [Bitwise AND of Numbers Range](https://leetcode.cn/problems/bitwise-and-of-numbers-range) | ✔ | Medium | | 338 | [Counting Bits](https://leetcode.cn/problems/counting-bits) | ✔ | Easy | ---- #### 2.位运算的技巧 | # | Title | Solution | Difficulty | |:---:|:------------------------------------------------------------------------|:--------:|:----------:| | 260 | [Single Number III](https://leetcode.cn/problems/single-number-iii) | ✔ | Medium | | 342 | [Power of Four](https://leetcode.cn/problems/power-of-four) | ✔ | Easy | | 371 | [Sum of Two Integers](https://leetcode.cn/problems/sum-of-two-integers) | ✔ | Easy | ---- #### 3.其余相关问题 | # | Title | Solution | Difficulty | |:---:|:------------------------------------------------------------------------------------|:--------:|:----------:| | 66 | [Plus One](https://leetcode.cn/problems/plus-one) | ✔ | Easy | | 67 | [Add Binary](https://leetcode.cn/problems/add-binary) | ✔ | Easy | | 50 | [Pow(x, n)](https://leetcode.cn/problems/powx-n) | ✔ | Medium | | 69 | [Sqrt(x)](https://leetcode.cn/problems/sqrtx) | ✔ | Easy | | 172 | [Factorial Trailing Zeroes](https://leetcode.cn/problems/factorial-trailing-zeroes) | ✔ | Medium | | 228 | [Summary Ranges](https://leetcode.cn/problems/summary-ranges) | ✔ | Easy | ---- ### 三. 二分查找篇 #### 1. 普通二分查找 | # | Title | Solution | Difficulty | |:----:|:------------------------------------------------------------------------------------------------------------------|:--------:|:----------:| | 4 | [Median of Two Sorted Arrays](https://leetcode.cn/problems/median-of-two-sorted-arrays) | ✔ | Hard | | 35 | [Search Insert Position](https://leetcode.cn/problems/search-insert-position) | ✔ | Easy | | 153 | [Find Minimum in Rotated Sorted Array](https://leetcode.cn/problems/find-minimum-in-rotated-sorted-array) | ✔ | Medium | | 162 | [Find Peak Element](https://leetcode.cn/problems/find-peak-element) | ✔ | Medium | | 367 | [Valid Perfect Square](https://leetcode.cn/problems/valid-perfect-square) | ✔ | Easy | | 704 | [Binary Search](https://leetcode.cn/problems/binary-search) | ✔ | Easy | | 744 | [Find Smallest Letter Greater Than Target](https://leetcode.cn/problems/find-smallest-letter-greater-than-target) | ✔ | Easy | | 1046 | [Last Stone Weight](https://leetcode.cn/problems/last-stone-weight/description/) | ✔ | Easy | ---- #### 2. 查找区间 | # | Title | Solution | Difficulty | |:---:|:------------------------------------------------------------------------------------------------------------------------------------------------|:--------:|:----------:| | 34 | [Find First and Last Position of Element in Sorted Array](https://leetcode.cn/problems/find-first-and-last-position-of-element-in-sorted-array) | ✔ | Medium | | 74 | [Search a 2D Matrix](https://leetcode.cn/problems/search-a-2d-matrix/) | ✔ | Medium | | 278 | [First Bad Version](https://leetcode.cn/problems/first-bad-version) | ✔ | Easy | | 658 | [Find K Closest Elements](https://leetcode.cn/problems/find-k-closest-elements/) | ✔ | Medium | ---- #### 3. 旋转排列数组 | # | Title | Solution | Difficulty | |:---:|:-----------------------------------------------------------------------------------------------------------------|:--------:|:----------:| | 33 | [Search in Rotated Sorted Array](https://leetcode.cn/problems/search-in-rotated-sorted-array) | | Medium | | 81 | [Search in Rotated Sorted Array II](https://leetcode.cn/problems/search-in-rotated-sorted-array-ii) | | Medium | | 48 | [Rotate Image](https://leetcode.cn/problems/rotate-image) | | Medium | | 154 | [Find Minimum in Rotated Sorted Array II](https://leetcode.cn/problems/find-minimum-in-rotated-sorted-array-ii) | | Hard | | 240 | [Search a 2D Matrix II](https://leetcode.cn/problems/search-a-2d-matrix-ii) | | Medium | | 448 | [ind All Numbers Disappeared in an Array](https://leetcode.cn/problems/find-all-numbers-disappeared-in-an-array) | | Easy | ---- ### 四. 哈希篇 #### 1. 哈希算法 | # | Title | Solution | Difficulty | |:---:|:------------------------------------------------------------------------------------------|:--------:|:----------:| | 49 | [Group Anagrams](https://leetcode.cn/problems/group-anagrams/description) | ✔ | Medium | | 128 | [Longest Consecutive Sequence](https://leetcode.cn/problems/longest-consecutive-sequence) | ✔ | Medium | | 202 | [Happy Number](https://leetcode.cn/problems/happy-number) | ✔ | Easy | | 205 | [Isomorphic Strings](https://leetcode.cn/problems/isomorphic-strings) | ✔ | Easy | | 219 | [Contains Duplicate II](https://leetcode.cn/problems/contains-duplicate-ii) | ✔ | Easy | | 242 | [Valid Anagram](https://leetcode.cn/problems/valid-anagram) | ✔ | Easy | | 290 | [Word Pattern](https://leetcode.cn/problems/word-pattern) | ✔ | Easy | | 383 | [Ransom Note](https://leetcode.cn/problems/ransom-note) | ✔ | Easy | | 447 | [Number of Boomerangs](https://leetcode.cn/problems/number-of-boomerangs) | ✔ | Medium | ---- ### 五. 链表篇 #### 1. 链表算法 | # | Title | Solution | Difficulty | |:---:|:--------------------------------------------------------------------------------------------|:--------:|:----------:| | 2 | [Add Two Numbers](https://leetcode.cn/problems/add-two-numbers) | ✔ | Medium | | 25 | [Reverse Nodes in k-Group](https://leetcode.cn/problems/reverse-nodes-in-k-group) | ✔ | Hard | | 61 | [Rotate List](https://leetcode.cn/problems/rotate-list) | ✔ | Medium | | 92 | [Reverse Linked List II](https://leetcode.cn/problems/reverse-linked-list-ii) | ✔ | Medium | | 138 | [Copy List with Random Pointer](https://leetcode.cn/problems/copy-list-with-random-pointer) | ✔ | Medium | | 146 | [LRU Cache](https://leetcode.cn/problems/lru-cache) | ✔ | Medium | ---- ### 六. 前缀和篇 #### 1. 一维数组的前缀和 | # | Title | Solution | Difficulty | |:----:|:-----------------------------------------------------------------------------------------------|:--------:|:----------:| | 523 | [Continuous Subarray Sum](https://leetcode.cn/problems/continuous-subarray-sum) | | Medium | | 525 | [Contiguous Array](https://leetcode.cn/problems/contiguous-array) | | Medium | | 560 | [Subarray Sum Equals K](https://leetcode.cn/problems/subarray-sum-equals-k) | | Medium | | 930 | [Binary Subarrays With Sum](https://leetcode.cn/problems/binary-subarrays-with-sum) | | Medium | | 974 | [Subarray Sums Divisible by K](https://leetcode.cn/problems/subarray-sums-divisible-by-k) | | Medium | | 1248 | [Count Number of Nice Subarrays](https://leetcode.cn/problems/count-number-of-nice-subarrays/) | | Hard | ---- #### 2. 二维数组的前缀和 | # | Title | Solution | Difficulty | |:----:|:------------------------------------------------------------------------------------------------------------------|:--------:|:----------:| | 304 | [Range Sum Query 2D - Immutable](https://leetcode.cn/problems/range-sum-query-2d-immutable) | | Medium | | 363 | [Max Sum of Rectangle No Larger Than K](https://leetcode.cn/problems/max-sum-of-rectangle-no-larger-than-k) | | Hard | | 1074 | [Number of Submatrices That Sum to Target](https://leetcode.cn/problems/number-of-submatrices-that-sum-to-target) | | Hard | | 1314 | [Matrix Block Sum](https://leetcode.cn/problems/matrix-block-sum) | | Medium | ---- #### 3. 前缀和与二叉树 | # | Title | Solution | Difficulty | |:----:|:------------------------------------------------------------------------------------------------------|:--------:|:----------:| | 437 | [Path Sum III](https://leetcode.cn/problems/path-sum-iii/description) | ✔ | Medium | | 1022 | [Sum of Root To Leaf Binary Numbers](https://leetcode.cn/problems/sum-of-root-to-leaf-binary-numbers) | ✔ | Easy | ---- ### 七. 滑动窗口篇 #### 1. 固定窗口大小的滑动窗口问题 | # | Title | Solution | Difficulty | |:----:|:------------------------------------------------------------------------------------------------------------------------------|:--------:|:----------:| | 3 | [Longest Substring Without Repeating Characters](https://leetcode.cn/problems/longest-substring-without-repeating-characters) | ✔ | Medium | | 76 | [Minimum Window Substring](https://leetcode.cn/problems/minimum-window-substring) | | Hard | | 80 | [Remove Duplicates from Sorted Array II](https://leetcode.cn/problems/remove-duplicates-from-sorted-array-ii/description) | ✔ | Medium | | 128 | [Longest Consecutive Sequence](https://leetcode.cn/problems/longest-consecutive-sequence) | | Easy | | 187 | [Repeated DNA Sequences](https://leetcode.cn/problems/repeated-dna-sequences) | ✔ | Medium | | 239 | [Sliding Window Maximum](https://leetcode.cn/problems/sliding-window-maximum) | | Hard | | 346 | [Balanced Binary Tree](https://leetcode.cn/problems/balanced-binary-tree) | | Easy | | 438 | [Find All Anagrams in a String](https://leetcode.cn/problems/find-all-anagrams-in-a-string) | | Medium | | 446 | [Arithmetic Slices II - Subsequence](https://leetcode.cn/problems/arithmetic-slices-ii-subsequence) | | Hard | | 457 | [Circular Array Loop](https://leetcode.cn/problems/circular-array-loop) | | Medium | | 480 | [Sliding Window Median](https://leetcode.cn/problems/sliding-window-median) | | Hard | | 567 | [Permutation in String](https://leetcode.cn/problems/permutation-in-string) | | Medium | | 643 | [Maximum Average Subarray I](https://leetcode.cn/problems/maximum-average-subarray-i) | ✔ | Easy | | 718 | [Maximum Length of Repeated Subarray](https://leetcode.cn/problems/maximum-length-of-repeated-subarray) | | Medium | | 1763 | [Longest Nice Substring](https://leetcode.cn/problems/longest-nice-substring) | | Easy | ---- #### 2. 不固定窗口大小的滑动窗口问题 | # | Title | Solution | Difficulty | |:----:|:----------------------------------------------------------------------------------------------------------------------------------------------|:--------:|:----------:| | 5 | [Longest Palindromic Substring](https://leetcode.cn/problems/longest-palindromic-substring) | | Medium | | 209 | [Minimum Size Subarray Sum](https://leetcode.cn/problems/minimum-size-subarray-sum) | ✔ | Medium | | 395 | [Longest Substring with At Least K Repeating Characters](https://leetcode.cn/problems/longest-substring-with-at-least-k-repeating-characters) | | Medium | | 560 | [Subarray Sum Equals K](https://leetcode.cn/problems/subarray-sum-equals-k) | | Medium | | 632 | [Smallest Range Covering Elements from K Lists](https://leetcode.cn/problems/smallest-range-covering-elements-from-k-lists) | | Hard | | 674 | [Longest Continuous Increasing Subsequence](https://leetcode.cn/problems/longest-continuous-increasing-subsequence) | | Easy | | 862 | [Shortest Subarray with Sum at Least K](https://leetcode.cn/problems/shortest-subarray-with-sum-at-least-k) | | Hard | | 904 | [Fruit Into Baskets](https://leetcode.cn/problems/fruit-into-baskets) | | Hard | | 943 | [Find the Shortest Superstring](https://leetcode.cn/problems/balance-a-binary-search-tree) | | Hard | | 2760 | [Longest Even Odd Subarray With Threshold](https://leetcode.cn/problems/longest-even-odd-subarray-with-threshold) | ✔ | Easy | ---- ### 八. 排序算法篇 #### 1. 排序算法 | # | Title | Solution | Difficulty | |:---:|:------------------------------------------------------------------------------------------------|:--------:|:----------:| | 23 | [Merge k Sorted Lists](https://leetcode.cn/problems/merge-k-sorted-lists/description) | ✔ | Hard | | 75 | [Sort Colors](https://leetcode.cn/problems/sort-colors) | ✔ | Medium | | 147 | [Insertion Sort List](https://leetcode.cn/problems/two-sum) | ✔ | Medium | | 215 | [Kth Largest Element in an Array](https://leetcode.cn/problems/kth-largest-element-in-an-array) | ✔ | Medium | | 220 | [Contains Duplicate III](https://leetcode.cn/problems/contains-duplicate-iii) | ✔ | Hard | | 347 | [ Top K Frequent Elements](https://leetcode.cn/problems/top-k-frequent-elements) | ✔ | Medium | | 912 | [Sort an Array](https://leetcode.cn/problems/sort-an-array) | ✔ | Medium | | 973 | [K Closest Points to Origin](https://leetcode.cn/problems/k-closest-points-to-origin) | ✔ | Medium | ---- ### 九. 栈和队列篇 #### 1. 栈和队列算法 | # | Title | Solution | Difficulty | |:---:|:--------------------------------------------------------------------------------------------------|:--------:|:----------:| | 20 | [Valid Parentheses](https://leetcode.cn/problems/valid-parentheses) | ✔ | Easy | | 71 | [Simplify Path](https://leetcode.cn/problems/simplify-path) | ✔ | Medium | | 150 | [Evaluate Reverse Polish Notation](https://leetcode.cn/problems/evaluate-reverse-polish-notation) | ✔ | Medium | | 155 | [Min Stack](https://leetcode.cn/problems/min-stack) | ✔ | Medium | | 224 | [Basic Calculator](https://leetcode.cn/problems/basic-calculator) | ✔ | Hard | ---- ### 十. 字符串和字符串算法篇 #### 1. 字符串算法 | # | Title | Solution | Difficulty | |:---:|:--------------------------------------------------------------------------------------------------------------------------------------|:--------:|:----------:| | 14 | [Longest Common Prefix](https://leetcode.cn/problems/longest-common-prefix) | ✔ | Easy | | 28 | [Find the Index of the First Occurrence in a String](https://leetcode.cn/problems/find-the-index-of-the-first-occurrence-in-a-string) | ✔ | Easy | | 344 | [Reverse String](https://leetcode.cn/problems/reverse-string) | ✔ | Easy | | 451 | [Sort Characters By Frequency](https://leetcode.cn/problems/sort-characters-by-frequency) | ✔ | Medium | ---- ### 十一. 双指针篇 #### 1. 对撞指针问题 | # | Title | Solution | Difficulty | |:---:|:----------------------------------------------------------------------------------------------------|:--------:|:----------:| | 1 | [Two Sum](https://leetcode.cn/problems/two-sum) | ✔ | Easy | | 9 | [Palindrome Number](https://leetcode.cn/problems/palindrome-number) | ✔ | Easy | | 11 | [Container With Most Water](https://leetcode.cn/problems/container-with-most-wat) | ✔ | Medium | | 15 | [3Sum](https://leetcode.cn/problems/3sum) | ✔ | Medium | | 18 | [4Sum](https://leetcode.cn/problems/4sum) | ✔ | Medium | | 27 | [Remove Element](https://leetcode.cn/problems/remove-element) | ✔ | Easy | | 88 | [Merge Sorted Array](https://leetcode.cn/problems/merge-sorted-array) | ✔ | Easy | | 125 | [Valid Palindrome](https://leetcode.cn/problems/valid-palindrome) | ✔ | Easy | | 167 | [Two Sum II - Input Array Is Sorted](https://leetcode.cn/problems/two-sum-ii-input-array-is-sorted) | ✔ | Medium | | 283 | [Move Zeroes](https://leetcode.cn/problems/move-zeroes) | ✔ | Medium | | 392 | [Is Subsequence](https://leetcode.cn/problems/is-subsequence) | ✔ | Easy | | 454 | [4Sum II](https://leetcode.cn/problems/4sum-ii) | ✔ | Medium | | 561 | [Array Partition](https://leetcode.cn/problems/array-partition) | ✔ | Easy | ---- #### 2. 快慢指针问题 | # | Title | Solution | Difficulty | |:---:|:------------------------------------------------------------------------------------------------------------|:--------:|:----------:| | 19 | [Remove Nth Node From End of List](https://leetcode.cn/problems/remove-nth-node-from-end-of-list) | ✔ | Medium | | 21 | [Merge Two Sorted Lists](https://leetcode.cn/problems/merge-two-sorted-lists) | ✔ | Easy | | 26 | [Remove Duplicates from Sorted Array](https://leetcode.cn/problems/remove-duplicates-from-sorted-array) | ✔ | Easy | | 82 | [Remove Duplicates from Sorted List II](https://leetcode.cn/problems/remove-duplicates-from-sorted-list-ii) | ✔ | Medium | | 83 | [Remove Duplicates from Sorted List](https://leetcode.cn/problems/remove-duplicates-from-sorted-list) | ✔ | Easy | | 86 | [Partition List](https://leetcode.cn/problems/partition-list) | ✔ | Medium | | 141 | [Linked List Cycle](https://leetcode.cn/problems/linked-list-cycle) | ✔ | Easy | | 142 | [Linked List Cycle II](https://leetcode.cn/problems/linked-list-cycle-ii) | ✔ | Medium | | 206 | [Reverse Linked List](https://leetcode.cn/problems/reverse-linked-list) | ✔ | Easy | | 234 | [Palindrome Linked List](https://leetcode.cn/problems/palindrome-linked-list) | ✔ | Easy | | 876 | [Middle of the Linked List](https://leetcode.cn/problems/middle-of-the-linked-list) | ✔ | Easy | ---- ### 十二. 并查集 | # | Title | Solution | Difficulty | |:---:|:-------------------------------------------------------------------------------------|:--------:|:----------:| | 547 | [Number of Provinces](https://leetcode.cn/problems/number-of-provinces/description/) | ✔ | Medium | ---- ## 进阶题专题 ### 一. 树与二叉树篇 #### 1. 二叉树遍历 | # | Title | Solution | Difficulty | |:---:|:-------------------------------------------------------------------------------------------------------------------------------------|:--------:|:----------:| | 94 | [Binary Tree Inorder Traversal](https://leetcode.cn/problems/binary-tree-inorder-traversal) | ✔ | Easy | | 100 | [Same Tree](https://leetcode.cn/problems/same-tree) | ✔ | Easy | | 102 | [Binary Tree Level Order Traversal](https://leetcode.cn/problems/binary-tree-level-order-traversal) | ✔ | Medium | | 103 | [Binary Tree Zigzag Level Order Traversal](https://leetcode.cn/problems/binary-tree-zigzag-level-order-traversal) | ✔ | Medium | | 107 | [Binary Tree Level Order Traversal II](https://leetcode.cn/problems/binary-tree-level-order-traversal-ii) | ✔ | Easy | | 114 | [Flatten Binary Tree to Linked List](https://leetcode.cn/problems/flatten-binary-tree-to-linked-list) | ✔ | Medium | | 116 | [Populating Next Right Pointers in Each Node](https://leetcode.cn/problems/populating-next-right-pointers-in-each-node/description/) | ✔ | Medium | | 117 | [Populating Next Right Pointers in Each Node II](https://leetcode.cn/problems/populating-next-right-pointers-in-each-node-ii) | ✔ | Medium | | 144 | [Binary Tree Preorder Traversal](https://leetcode.cn/problems/binary-tree-preorder-traversal) | ✔ | Easy | | 145 | [Binary Tree Postorder Traversal](https://leetcode.cn/problems/binary-tree-postorder-traversal) | ✔ | Easy | | 429 | [N-ary Tree Level Order Traversal](https://leetcode.cn/problems/n-ary-tree-level-order-traversal/description/) | ✔ | Medium | | 515 | [Find Largest Value in Each Tree Row](https://leetcode.cn/problems/find-largest-value-in-each-tree-row/description/) | ✔ | Medium | | 637 | [Average of Levels in Binary Tree](https://leetcode.cn/problems/average-of-levels-in-binary-tree/description/) | ✔ | Easy | #### 2. 二叉树的构造与修改 | # | Title | Solution | Difficulty | |:---:|:--------------------------------------------------------------------------------------------------------------------------------------------------------|:--------:|:----------:| | 105 | [Construct Binary Tree from Preorder and Inorder Traversal](https://leetcode.cn/problems/construct-binary-tree-from-preorder-and-inorder-traversal) | ✔ | Medium | | 106 | [Construct Binary Tree from Inorder and Postorder Traversal](https://leetcode.cn/problems/construct-binary-tree-from-inorder-and-postorder-traversal) | ✔ | Medium | | 226 | [Invert Binary Tree](https://leetcode.cn/problems/invert-binary-tree) | ✔ | Easy | | 617 | [Merge Two Binary Trees](https://leetcode.cn/problems/merge-two-binary-trees) | ✔ | Easy | | 654 | [Maximum Binary Tree](https://leetcode.cn/problems/maximum-binary-tree/description/) | ✔ | Medium | | 889 | [Construct Binary Tree from Preorder and Postorder Traversal](https://leetcode.cn/problems/construct-binary-tree-from-preorder-and-postorder-traversal) | | Medium | #### 3. 二叉树的搜索问题 | # | Title | Solution | Difficulty | |:----:|:------------------------------------------------------------------------------------------------------------------------|:--------:|:----------:| | 101 | [Symmetric Tree](https://leetcode.cn/problems/symmetric-tree) | ✔ | Medium | | 222 | [Count Complete Tree Nodes](https://leetcode.cn/problems/count-complete-tree-nodes) | ✔ | Medium | | 199 | [Binary Tree Right Side View](https://leetcode.cn/problems/binary-tree-right-side-view) | ✔ | Medium | | 404 | [Sum of Left Leaves](https://leetcode.cn/problems/sum-of-left-leaves) | ✔ | Medium | | 513 | [Find Bottom Left Tree Value](https://leetcode.cn/problems/find-bottom-left-tree-value/) | ✔ | Medium | | 515 | [Find Largest Value in Each Tree Row](https://leetcode.cn/problems/find-largest-value-in-each-tree-row/) | | Medium | | 623 | [Add One Row to Tree](https://leetcode.cn/problems/add-one-row-to-tree) | | Medium | | 655 | [Print Binary Tree](https://leetcode.cn/problems/print-binary-tree) | | Medium | | 834 | [Sum of Distances in Tree](https://leetcode.cn/problems/sum-of-distances-in-tree) | | Medium | | 863 | [All Nodes Distance K in Binary Tree](https://leetcode.cn/problems/all-nodes-distance-k-in-binary-tree) | | Medium | | 865 | [Smallest Subtree with all the Deepest Nodes](https://leetcode.cn/problems/smallest-subtree-with-all-the-deepest-nodes) | | Medium | | 1399 | [Maximum Product of Splitted Binary Tree](https://leetcode.cn/problems/maximum-product-of-splitted-binary-tree) | | Medium | #### 4. 二叉树的路径问题 | # | Title | Solution | Difficulty | |:----:|:------------------------------------------------------------------------------------------------------|:--------:|:----------:| | 4.12 | [Paths with Sum LCCI](https://leetcode.cn/problems/paths-with-sum-lcci) | | Medium | | 112 | [Path Sum](https://leetcode.cn/problems/path-sum) | ✔ | Easy | | 113 | [Path Sum II](https://leetcode.cn/problems/path-sum-ii) | ✔ | Medium | | 124 | [Binary Tree Maximum Path Sum](https://leetcode.cn/problems/binary-tree-maximum-path-sum) | | Easy | | 129 | [Sum Root to Leaf Numbers](https://leetcode.cn/problems/sum-root-to-leaf-numbers) | ✔ | Medium | | 257 | [Binary Tree Paths](https://leetcode.cn/problems/binary-tree-paths) | ✔ | Easy | | 437 | [Path Sum III](https://leetcode.cn/problems/path-sum-iii) | | Easy | | 543 | [Diameter of Binary Tree](https://leetcode.cn/problems/diameter-of-binary-tree) | | Easy | | 988 | [Smallest String Starting From Leaf](https://leetcode.cn/problems/smallest-string-starting-from-leaf) | | Easy | #### 5. 二叉树属性问题 | # | Title | Solution | Difficulty | |:---:|:------------------------------------------------------------------------------------------|:--------:|:----------:| | 104 | [Maximum Depth of Binary Tree](https://leetcode.cn/problems/maximum-depth-of-binary-tree) | ✔ | Easy | | 111 | [Minimum Depth of Binary Tree](https://leetcode.cn/problems/minimum-depth-of-binary-tree) | ✔ | Easy | #### 6. 二叉树公共祖先问题 | # | Title | Solution | Difficulty | |:----:|:------------------------------------------------------------------------------------------------------------------------------|:--------:|:----------:| | 235 | [Lowest Common Ancestor of a Binary Search Tree](https://leetcode.cn/problems/lowest-common-ancestor-of-a-binary-search-tree) | | Easy | | 236 | [Lowest Common Ancestor of a Binary Tree](https://leetcode.cn/problems/lowest-common-ancestor-of-a-binary-tree) | ✔ | Medium | | 1483 | [Kth Ancestor of a Tree Node](https://leetcode.cn/problems/kth-ancestor-of-a-tree-node) | | Medium | #### 7. 二叉搜索树 | # | Title | Solution | Difficulty | |:----:|:------------------------------------------------------------------------------------------------------------------------------|:--------:|:----------:| | 98 | [Validate Binary Search Tree](https://leetcode.cn/problems/validate-binary-search-tree) | ✔ | Easy | | 108 | [Convert Sorted Array to Binary Search Tree](https://leetcode.cn/problems/convert-sorted-array-to-binary-search-tree) | ✔ | Medium | | 173 | [Binary Search Tree Iterator](https://leetcode.cn/problems/binary-search-tree-iterator) | ✔ | Easy | | 230 | [Kth Smallest Element in a BST](https://leetcode.cn/problems/kth-smallest-element-in-a-bst) | ✔ | Medium | | 235 | [Lowest Common Ancestor of a Binary Search Tree](https://leetcode.cn/problems/lowest-common-ancestor-of-a-binary-search-tree) | ✔ | Medium | | 450 | [Delete Node in a BST](https://leetcode.cn/problems/delete-node-in-a-bst) | ✔ | Medium | | 501 | [Find Mode in Binary Search Tree](https://leetcode.cn/problems/find-mode-in-binary-search-tree/description/) | ✔ | Easy | | 530 | [Minimum Absolute Difference in BST](https://leetcode.cn/problems/minimum-absolute-difference-in-bst) | ✔ | Easy | | 538 | [Convert BST to Greater Tree](https://leetcode.cn/problems/convert-bst-to-greater-tree) | ✔ | Medium | | 669 | [Trim a Binary Search Tree](https://leetcode.cn/problems/trim-a-binary-search-tree) | ✔ | Medium | | 700 | [Search in a Binary Search Tree](https://leetcode.cn/problems/search-in-a-binary-search-tree/description/) | ✔ | Medium | | 701 | [Insert into a Binary Search Tree](https://leetcode.cn/problems/insert-into-a-binary-search-tree) | ✔ | Medium | | 783 | [Minimum Distance Between BST Nodes](https://leetcode.cn/problems/minimum-distance-between-bst-nodes) | | Easy | | 1038 | [Binary Search Tree to Greater Sum Tree](https://leetcode.cn/problems/binary-search-tree-to-greater-sum-tree) | | Easy | #### 8. 平衡二叉树 | # | Title | Solution | Difficulty | |:----:|:--------------------------------------------------------------------------------------------------------------------|:--------:|:----------:| | 109 | [Convert Sorted List to Binary Search Tree](https://leetcode.cn/problems/convert-sorted-list-to-binary-search-tree) | | Medium | | 110 | [Balanced Binary Tree](https://leetcode.cn/problems/balanced-binary-tree) | ✔ | Easy | | 1382 | [Balance a Binary Search Tree](https://leetcode.cn/problems/balance-a-binary-search-tree) | | Medium | ---- ### 二. 递归(回溯)篇 | # | Title | Solution | Difficulty | |:---:|:------------------------------------------------------------------------------------------------------------|:--------:|:----------:| | 17 | [Letter Combinations of a Phone Number](https://leetcode.cn/problems/letter-combinations-of-a-phone-number) | ✔ | Medium | | 39 | [Combination Sum](https://leetcode.cn/problems/combination-sum/description/) | ✔ | Medium | | 40 | [Combination Sum II](https://leetcode.cn/problems/combination-sum-ii/description/) | ✔ | Medium | | 46 | [Permutations](https://leetcode.cn/problems/permutations/description/) | ✔ | Medium | | 47 | [Permutations II](https://leetcode.cn/problems/permutations-ii/description/) | ✔ | Medium | | 77 | [Combinations](https://leetcode.cn/problems/combinations/description/) | ✔ | Medium | | 216 | [Combination Sum III](https://leetcode.cn/problems/combination-sum-iii/description/) | ✔ | Medium | ---- ### 三. 贪心篇 | # | Title | Solution | Difficulty | |:----:|:------------------------------------------------------------------------------------------------------------------------------|:--------:|:----------:| | 455 | [Assign Cookies](https://leetcode.cn/problems/assign-cookies) | ✔ | Easy | | 860 | [Lemonade Change](https://leetcode.cn/problems/lemonade-change/description/) | ✔ | Easy | | 1005 | [LMaximize Sum Of Array After K Negations](https://leetcode.cn/problems/maximize-sum-of-array-after-k-negations/description/) | ✔ | Easy | ---- ### 四. 动态规划篇 | # | Title | Solution | Difficulty | |:----:|:-------------------------------------------------------------------------------------------------------------------|:--------:|:----------:| | 53 | [Maximum Subarray](https://leetcode.cn/problems/maximum-subarray/description/) | ✔ | Medium | | 62 | [Unique Paths](https://leetcode.cn/problems/unique-paths/) | ✔ | Medium | | 63 | [Unique Paths II](https://leetcode.cn/problems/unique-paths-ii/description/) | ✔ | Medium | | 64 | [Minimum Path Sum](https://leetcode.cn/problems/unique-paths/) | ✔ | Medium | | 70 | [Climbing Stairs](https://leetcode.cn/problems/climbing-stairs/) | ✔ | Easy | | 72 | [Edit Distance](https://leetcode.cn/problems/edit-distance/) | ✔ | Medium | | 96 | [Unique Binary Search Trees](https://leetcode.cn/problems/unique-binary-search-trees/description/) | ✔ | Medium | | 120 | [Triangle](https://leetcode.cn/problems/triangle/description/) | ✔ | Medium | | 121 | [Best Time to Buy and Sell Stock](https://leetcode.cn/problems/best-time-to-buy-and-sell-stock) | ✔ | Easy | | 122 | [Best Time to Buy and Sell Stock II](https://leetcode.cn/problems/best-time-to-buy-and-sell-stock-ii/description/) | ✔ | Medium | | 152 | [152. Maximum Product Subarray](https://leetcode.cn/problems/maximum-product-subarray/description/) | ✔ | Medium | | 198 | [House Robber](https://leetcode.cn/problems/house-robber/description/) | ✔ | Medium | | 213 | [House Robber II](https://leetcode.cn/problems/house-robber-ii/description/) | ✔ | Medium | | 300 | [Longest Increasing Subsequence](https://leetcode.cn/problems/longest-increasing-subsequence/) | ✔ | Easy | | 343 | [Integer Break](https://leetcode.cn/problems/integer-break/description/) | ✔ | Medium | | 416 | [Partition Equal Subset Sum](https://leetcode.cn/problems/partition-equal-subset-sum/description/) | ✔ | Medium | | 509 | [Fibonacci Numbe](https://leetcode.cn/problems/fibonacci-number/description/) | ✔ | Easy | | 746 | [Min Cost Climbing Stairs](https://leetcode.cn/problems/min-cost-climbing-stairs/description/) | ✔ | Easy | | 1143 | [Longest Common Subsequence](https://leetcode.cn/problems/longest-common-subsequence/description/) | ✔ | Medium | | 1049 | [ Last Stone Weight II](https://leetcode.cn/problems/last-stone-weight-ii/description/) | ✔ | Medium | ----