Linked Lists, Trees & Backtracking
Track 2 starts here, and every plan from now on leans on recursion. Linked lists and binary trees are where most people first write a function that calls itself, and backtracking extends the same idea to trying every choice and undoing it.
The five chapters go from linked lists, starting with problems like Reverse Linked List, to binary trees, general trees, backtracking, and recursion with divide and conquer. It suits anyone who wants recursion to feel routine before moving on to grids, dynamic programming and graphs.
Want company while you work through this list? Sign in, open the study room, and your heroine will bring you the problems one at a time.
I. Linked Lists
§1.1 Traverse Linked List
§1.2 Delete Node
§1.3 Insert Node
| Problem | Rating |
|---|---|
| 2807. Insert Greatest Common Divisors in Linked List | 1279 |
| 147. Insertion Sort List | Unrated |
§1.4 Reverse Linked List
| Problem | Rating |
|---|---|
| 206. Reverse Linked List | Unrated |
| 92. Reverse Linked List II | Unrated |
| 24. Swap Nodes in Pairs | Unrated |
| 25. Reverse Nodes in K Group | Unrated |
| 2074. Reverse Nodes in Even Length Groups | 1685 |
§1.5 Leading and Trailing Pointers
| Problem | Rating |
|---|---|
| 19. Remove Nth Node From End of List | Unrated |
| 61. Rotate List | Unrated |
| 1721. Swapping Nodes in a Linked List | 1387 |
§1.6 Fast and Slow Pointers
| Problem | Rating |
|---|---|
| 876. Middle of the Linked List | 1232 |
| 2095. Delete the Middle Node of a Linked List | 1324 |
| 234. Palindrome Linked List | Unrated |
| 2130. Maximum Twin Sum of a Linked List | 1318 |
| 143. Reorder List | Unrated |
| 141. Linked List Cycle | Unrated |
| 142. Linked List Cycle II | Unrated |
| 457. Circular Array Loop | Unrated |
§1.7 Two Pointers
| Problem | Rating |
|---|---|
| 328. Odd Even Linked List | Unrated |
| 86. Partition List | Unrated |
| 160. Intersection of Two Linked Lists | Unrated |
§1.8 Merging Linked Lists
| Problem | Rating |
|---|---|
| 2. Add Two Numbers | Unrated |
| 445. Add Two Numbers II | Unrated |
| 2816. Double a Number Represented As a Linked List | 1394 |
| 21. Merge Two Sorted Lists | Unrated |
§1.9 Divide-and-Conquer
| Problem | Rating |
|---|---|
| 23. Merge K Sorted Lists | Unrated |
| 148. Sort List | Unrated |
§1.10 Mixed Practice
| Problem | Rating |
|---|---|
| 1171. Remove Zero Sum Consecutive Nodes From Linked List | 1782 |
| 707. Design Linked List | Unrated |
| 146. Lru Cache | Unrated |
| 460. Lfu Cache | Unrated |
| 432. All Oone Data Structure | Unrated |
| 1206. Design Skiplist | Unrated |
§1.11 Miscellaneous
| Problem | Rating |
|---|---|
| 138. Copy List with Random Pointer | Unrated |
| 382. Linked List Random Node | Unrated |
| 430. Flatten a Multilevel Doubly Linked List | Unrated |
II. Binary Trees
§2.1 Traverse Binary Tree
| Problem | Rating |
|---|---|
| 144. Binary Tree Preorder Traversal | Unrated |
| 94. Binary Tree Inorder Traversal | Unrated |
| 145. Binary Tree Postorder Traversal | Unrated |
| 872. Leaf Similar Trees | 1288 |
| 404. Sum of Left Leaves | Unrated |
| 671. Second Minimum Node in a Binary Tree | Unrated |
§2.2 Top-Down DFS (Preorder)
§2.3 Bottom-Up DFS (Postorder)
§2.4 Bottom-Up DFS: Deleting Nodes
| Problem | Rating |
|---|---|
| 814. Binary Tree Pruning | 1380 |
| 1325. Delete Leaves with a Given Value | 1407 |
| 1110. Delete Nodes AND Return Forest | 1511 |
§2.5 Work on the Way Down and Back Up
§2.6 Binary Tree Diameter
| Problem | Rating |
|---|---|
| 543. Diameter of Binary Tree | Unrated |
| 687. Longest Univalue Path | Unrated |
| 124. Binary Tree Maximum Path Sum | Unrated |
| 2385. Amount of Time for Binary Tree to Be Infected | 1711 |
§2.7 Backtracking
| Problem | Rating |
|---|---|
| 257. Binary Tree Paths | Unrated |
| 113. Path Sum II | Unrated |
| 1457. Pseudo Palindromic Paths in a Binary Tree | 1405 |
| 437. Path Sum III | Unrated |
§2.8 Lowest Common Ancestor (LCA)
§2.9 Binary Search Tree (BST)
§2.10 Building Binary Trees
§2.11 Inserting and Deleting Nodes
| Problem | Rating |
|---|---|
| 701. Insert Into a Binary Search Tree | Unrated |
| 450. Delete Node in a Bst | Unrated |
| 669. Trim a Binary Search Tree | Unrated |
§2.12 Tree DP
| Problem | Rating |
|---|---|
| 337. House Robber III | Unrated |
| 968. Binary Tree Cameras | 2124 |
§2.13 Binary Tree BFS
§2.14 Linked Lists and Binary Trees
§2.15 N-ary Trees
§2.16 Miscellaneous
III. General Trees
§3.1 General Tree Traversal
| Problem | Rating |
|---|---|
| 2368. Reachable Nodes with Restrictions | 1477 |
| 1466. Reorder Routes to Make All Paths Lead to the City Zero | 1634 |
§3.2 Top-Down Tree DFS
§3.3 Bottom-Up Tree DFS
§3.4 Work on the Way Down and Back Up
| Problem | Rating |
|---|---|
| 3593. Minimum Increments to Equalize Leaf Paths | 1959 |
| 3331. Find Subtree Sizes After Changes | 2046 |
§3.5 Tree Diameter
§3.6 Topological Sort on Trees
| Problem | Rating |
|---|---|
| 310. Minimum Height Trees | Unrated |
| 2603. Collect Coins in a Tree | 2712 |
§3.7 DFS Timestamps (Euler Tour)
| Problem | Rating |
|---|---|
| 3515. Shortest Path in a Weighted Tree | 2312 |
| 2322. Minimum Score After Removals on a Tree | 2392 |
| 3327. Check If DFS Strings Are Palindromes | 2454 |
| 3590. Kth Smallest Path XOR Sum | 2646 |
§3.8 Lowest Common Ancestor (LCA) and Binary Lifting
§3.9 Sliding Window on Trees
| Problem | Rating |
|---|---|
| 3425. Longest Special Path | 2435 |
| 3486. Longest Special Path II | 2925 |
§3.10 Small-to-Large Merging on Trees
| Problem | Rating |
|---|---|
| 2003. Smallest Missing Genetic Value in Each Subtree | 2415 |
| 3590. Kth Smallest Path XOR Sum | 2646 |
| 3575. Maximum Good Subtree Score | 2360 |
§3.11 Centroid Decomposition
| Problem | Rating |
|---|---|
| 3372. Maximize the Number of Target Nodes After Connecting Trees I | 1927 |
§3.12 Miscellaneous
| Problem | Rating |
|---|---|
| 2867. Count Valid Paths in a Tree | 2428 |
| 2421. Number of Good Paths | 2445 |
| 1719. Number of Ways to Reconstruct a Tree | 3018 |
IV. Backtracking
§4.1 Introductory Backtracking
| Problem | Rating |
|---|---|
| 17. Letter Combinations of a Phone Number | Unrated |
§4.2 Subset Backtracking
§4.3 Partition Backtracking
§4.4 Combination Backtracking
| Problem | Rating |
|---|---|
| 77. Combinations | Unrated |
| 216. Combination Sum III | Unrated |
| 1286. Iterator for Combination | 1591 |
| 22. Generate Parentheses | Unrated |
| 301. Remove Invalid Parentheses | Unrated |
§4.5 Permutation Backtracking
§4.6 Backtracking with Duplicate Elements
| Problem | Rating |
|---|---|
| 90. Subsets II | Unrated |
| 40. Combination Sum II | Unrated |
| 491. Non Decreasing Subsequences | Unrated |
| 47. Permutations II | Unrated |
| 1079. Letter Tile Possibilities | 1741 |
| 3646. Next Special Palindrome Number | 2445 |
| 2014. Longest Subsequence Repeated K Times | 2558 |
§4.7 Backtracking Search
§4.8 Meet in the Middle
V. Recursion & Divide-and-Conquer
V. Recursion and Divide-and-Conquer
It is the first plan on Track 2; the route suggests it after Strings & Automata, but you can start here directly by picking it when you sign your study contract.
Ratings come from zerotrac's LeetCode contest ratings. Some problems have no zerotrac rating and are marked Unrated.
Open the study room