Files
leetcode/README.md
T

8.2 KiB
Raw Blame History

header

follow badge

Phase I — Linear Structures (Week 1)

1. Hash-Based Lookup — builds on nothing

Set LC # Problem
A 217 Contains Duplicate
A 242 Valid Anagram
A 1 Two Sum
A 49 Group Anagrams
A 347 Top K Frequent Elements
B 383 Ransom Note
B 205 Isomorphic Strings
B 128 Longest Consecutive Sequence
B 290 Word Pattern

2. Prefix Sum — builds on 1

Set LC # Problem
A 303 Range Sum Query
A 238 Product of Array Except Self
A 560 Subarray Sum Equals K
B 525 Contiguous Array
B 974 Subarray Sums Divisible by K

3. Two Pointers — builds on ordered iteration

Set LC # Problem
A 125 Valid Palindrome
A 167 Two Sum II
A 15 3Sum
A 11 Container With Most Water
A 42 Trapping Rain Water
B 392 Is Subsequence
B 977 Squares of a Sorted Array
B 189 Rotate Array
B 80 Remove Duplicates II

4. Sliding Window — builds on 3

Set LC # Problem
A 121 Best Time to Buy and Sell Stock
A 3 Longest Substring Without Repeating Characters
A 424 Longest Repeating Character Replacement
A 567 Permutation in String
A 76 Minimum Window Substring
B 209 Minimum Size Subarray Sum
B 1004 Max Consecutive Ones III
B 643 Maximum Average Subarray

5. Binary Search — builds on ordered/monotonic invariants

Set LC # Problem
A 704 Binary Search
A 74 Search a 2D Matrix
A 875 Koko Eating Bananas
A 33 Search in Rotated Sorted Array
A 153 Find Minimum in Rotated Sorted Array
B 35 Search Insert Position
B 162 Find Peak Element
B 34 First & Last Position
B 4 Median of Two Sorted Arrays

6. Stack — independent primitive

Set LC # Problem
A 20 Valid Parentheses
A 155 Min Stack
A 150 Evaluate Reverse Polish Notation
B 71 Simplify Path
B 224 Basic Calculator

7. Monotonic Stack — builds on 6

Set LC # Problem
A 739 Daily Temperatures
A 853 Car Fleet
B 496 Next Greater Element I
B 901 Online Stock Span
B 84 Largest Rectangle in Histogram

Phase II — Nodal & Grid Structures (Week 2)

8. Linked List — independent primitive

Set LC # Problem
A 206 Reverse Linked List
A 21 Merge Two Sorted Lists
A 141 Linked List Cycle
A 19 Remove Nth Node From End
A 143 Reorder List
B 876 Middle of the Linked List
B 92 Reverse Linked List II
B 82 Remove Duplicates from Sorted List II
B 61 Rotate List
B 86 Partition List

9. Hybrid Structures — builds on 1 + 8

Set LC # Problem
A 146 LRU Cache
A 2 Add Two Numbers
B 138 Copy List with Random Pointer
B 380 Insert Delete GetRandom O(1)

10. Matrix Index Math — builds on 3

Set LC # Problem
A 48 Rotate Image
A 54 Spiral Matrix
A 73 Set Matrix Zeroes
B 36 Valid Sudoku
B 289 Game of Life

Phase III — Hierarchical Structures (Week 3)

11. Tree DFS — builds on recursion

Set LC # Problem
A 226 Invert Binary Tree
A 104 Maximum Depth of Binary Tree
A 100 Same Tree
A 572 Subtree of Another Tree
A 236 Lowest Common Ancestor
A 124 Binary Tree Maximum Path Sum
B 101 Symmetric Tree
B 112 Path Sum
B 129 Sum Root to Leaf Numbers
B 543 Diameter of Binary Tree

12. Tree BFS — builds on 6's sibling (queue) + 11

Set LC # Problem
A 102 Level Order Traversal
A 199 Right Side View
A 1448 Count Good Nodes
B 103 Zigzag Level Order
B 637 Average of Levels

13. Binary Search Tree — builds on 5 + 11

Set LC # Problem
A 98 Validate BST
A 230 Kth Smallest in BST
A 235 LCA of BST
A 105 Build from Preorder + Inorder
B 530 Minimum Absolute Difference
B 173 BST Iterator
B 108 Sorted Array to BST

14. Heap / Priority Queue — builds on trees (implicit tree over array)

Set LC # Problem
A 215 Kth Largest in Array
A 703 Kth Largest in Stream
A 973 K Closest Points
A 621 Task Scheduler
A 23 Merge K Sorted Lists
B 1046 Last Stone Weight
B 373 K Pairs with Smallest Sums
B 295 Find Median from Data Stream
B 502 IPO

15. Trie — builds on 11

Set LC # Problem
A 208 Implement Trie
A 211 Add & Search Words
B 212 Word Search II (needs topic 20 — schedule after)

Phase IV — Relational Structures (Week 4)

16. Graph DFS — builds on 11 + visited set

Set LC # Problem
A 200 Number of Islands
A 695 Max Area of Island
A 133 Clone Graph
A 417 Pacific Atlantic Water Flow
A 130 Surrounded Regions
B 399 Evaluate Division
B 261 Graph Valid Tree

17. Graph BFS — builds on 12 + visited set

Set LC # Problem
A 994 Rotting Oranges
A 127 Word Ladder
B 909 Snakes and Ladders
B 433 Minimum Genetic Mutation
B 286 Walls and Gates

18. Topological Sort — builds on 16

Set LC # Problem
A 207 Course Schedule
A 210 Course Schedule II
B 269 Alien Dictionary
B 1462 Course Schedule IV

19. Union-Find — builds on 16's problem class

Set LC # Problem
A 684 Redundant Connection
A 323 Number of Connected Components
B 128 Longest Consecutive (union-find variant)
B 721 Accounts Merge

Phase V — Decision-Space Exploration (Weeks 45)

20. Backtracking — builds on 16

Set LC # Problem
A 78 Subsets
A 39 Combination Sum
A 46 Permutations
A 79 Word Search
B 17 Letter Combinations
B 77 Combinations
B 22 Generate Parentheses
B 52 N-Queens II

(Now unlock 212 Word Search II from topic 15.)

21. 1-D Dynamic Programming — builds on 20

Set LC # Problem
A 70 Climbing Stairs
A 746 Min Cost Climbing Stairs
A 198 House Robber
A 213 House Robber II
A 322 Coin Change
A 300 Longest Increasing Subsequence
B 139 Word Break
B 91 Decode Ways
B 647 Palindromic Substrings

22. Multi-D / Grid DP — builds on 21

Set LC # Problem
A 62 Unique Paths
A 64 Minimum Path Sum
A 1143 Longest Common Subsequence
B 120 Triangle
B 63 Unique Paths II
B 72 Edit Distance
B 221 Maximal Square
B 97 Interleaving String

23. Greedy — builds on 21

Set LC # Problem
A 53 Maximum Subarray (Kadane's)
A 55 Jump Game
A 45 Jump Game II
A 134 Gas Station
B 122 Best Time to Buy and Sell Stock II
B 918 Maximum Sum Circular Subarray
B 763 Partition Labels

24. Intervals — builds on 23

Set LC # Problem
A 57 Insert Interval
A 56 Merge Intervals
A 435 Non-Overlapping Intervals
A 253 Meeting Rooms II
B 228 Summary Ranges
B 452 Minimum Arrows to Burst Balloons
B 920 Meeting Rooms I