Learning Path and Practice Guide
Chapter 43: Learning Path and Practice Guide
You have decided to study algorithms systematically. You open LeetCode, see 3000+ problems, and your first reaction is: "Where do I even start?"
This "choice paralysis" drains more energy than the problems themselves. The goal of this chapter is to eliminate that uncertainty: to give you a clear roadmap from "absolute beginner" to "passing top-tier company interviews" to "competitive programming." Each stage has a concrete problem list, time plan, and measurable milestones.
More importantly, this chapter addresses something most grinders overlook: how to transition from "solving problems" to "writing production code." Interviews are just the gate to employment; once inside, your code must survive peer review, run in production, and remain maintainable three years later. There is a bridge between algorithmic ability and engineering ability, and this chapter helps you cross it.
Level 1 ยท What You Need to Know
1.1 Difficulty-Graded Practice Roadmap
Stage One: Beginner (0-2 months, target 50 problems)
Prerequisites: Basic syntax in one programming language (loops, conditionals, functions, arrays)
Goal: Build a basic "problem โ data structure" mapping, solve Easy problems reliably
| Week | Topic | Core Knowledge | Suggested Problems | Book Chapters |
|---|---|---|---|---|
| 1-2 | Array Basics | Traversal, two pointers, prefix sums | 10 | Ch. 2 |
| 3 | Strings | Two pointers, hashing | 5 | Ch. 2, 8 |
| 4 | Hash Tables | Counter, mapping | 8 | Ch. 8 |
| 5 | Linked Lists | Dummy head, fast/slow pointers | 7 | Ch. 4 |
| 6 | Stacks/Queues | Bracket matching, basic monotonic stack | 8 | Ch. 5 |
| 7 | Binary Trees | Traversal, recursion | 7 | Ch. 19 |
| 8 | Sorting/Binary Search | Basic binary search | 5 | Ch. 3, 11 |
Core principles for the beginner stage:
# Principle 1: Cap each problem at 30 minutes
# If you cannot figure it out in 30 minutes, read the editorial.
# At this stage the goal is "exposure," not "independent invention."
# Principle 2: After reading an editorial, rewrite the solution from scratch
# Close the editorial, open a blank editor, and write it from understanding.
# If you cannot do this, you only "saw" the solution โ you did not "learn" it.
# Principle 3: Study by category, not randomly
# Do 5-8 problems of the same type in a row to build pattern recognition.
# Random grinding is like cold-starting your brain every single time.
def beginner_workflow(problem):
"""The problem-solving workflow for beginners"""
# 1. Read the problem, draw examples
understand(problem)
# 2. Spend 5 minutes: does this resemble something I have seen before?
pattern = try_match(problem, time_limit=5)
# 3. If you have an idea, attempt implementation (25 min limit)
if pattern:
solution = implement(pattern, time_limit=25)
else:
# 4. No idea? Go directly to the editorial
solution = read_editorial(problem)
# 5. Regardless of whether you read the editorial:
# Close everything and rewrite from memory
rewrite_from_memory(solution)
# 6. Record: what is the pattern? What is the key insight?
note = {
"pattern": pattern,
"key_insight": "...",
"where_i_got_stuck": "...",
"review_date": today + timedelta(days=3), # spaced repetition
}
Stage Two: Intermediate (2-4 months, target 150 problems)
Prerequisites: Beginner stage complete, Easy solve rate > 80%
Goal: Independently solve most Medium problems, master all common algorithm patterns
| Week | Topic | Core Knowledge | Suggested Problems | Book Chapters |
|---|---|---|---|---|
| 1-2 | Sliding Window | Fixed/variable-length windows | 10 | Ch. 2 |
| 3-4 | Advanced Binary Search | Binary search on answer, rotated arrays | 10 | Ch. 3 |
| 5-6 | BFS/DFS | Grid traversal, graph traversal | 15 | Ch. 22 |
| 7-8 | Backtracking | Combinations/permutations/subsets | 10 | Ch. 26 |
| 9-10 | DP Foundations | 1D DP, knapsack | 15 | Ch. 27 |
| 11-12 | Advanced DP | 2D DP, interval DP | 12 | Ch. 28 |
| 13-14 | Greedy | Interval scheduling, jump games | 10 | Ch. 25 |
| 15-16 | Advanced Trees | BST, LCA, serialization | 10 | Ch. 20-21 |
| 17 | Heaps | Top-K, median | 8 | Ch. 12 |
| 18 | Graph Algorithms | Topological sort, shortest paths | 10 | Ch. 22-24 |
| 19-20 | Design Problems | LRU, Trie, prefix sums | 10 | Ch. 6-10 |
| 21-24 | Mixed Practice | Random Medium problems | 30 | โ |
Core principles for the intermediate stage:
# Principle 1: 45-minute time limit (simulating an interview)
# If you cannot solve it in 45 minutes, your pattern recognition
# for this problem type is not yet strong enough.
# Principle 2: Optimize after solving
# The Easy-level solution is not enough โ ask yourself:
# Can I do this faster? Can I use less space?
# Principle 3: Weekly review
# Spend 2 hours every weekend re-doing problems you got wrong
# or needed editorials for. No review = wasting 70% of your effort.
def intermediate_workflow(problem):
"""The problem-solving workflow for intermediate learners"""
# 1. Solve independently with a 45-minute limit
start = time.now()
solution = solve_independently(problem, time_limit=45)
# 2. If solved:
if solution.is_correct():
# Compare with the optimal solution โ is yours optimal?
optimal = read_editorial(problem)
if solution.complexity > optimal.complexity:
# Study the optimization technique
learn_optimization(solution, optimal)
# 3. If not solved:
else:
# Read only the hint, not the full editorial
hint = get_hint(problem) # "Try dynamic programming" or "Use a monotonic stack"
solution = retry_with_hint(problem, hint, time_limit=20)
if not solution.is_correct():
# Read full editorial + rewrite from memory
editorial = read_editorial(problem)
rewrite_from_memory(editorial)
# 4. Post-mortem analysis
analysis = {
"pattern": identify_pattern(problem),
"my_approach": solution.approach,
"optimal_approach": optimal.approach if optimal else solution.approach,
"gap_reason": "...",
"next_time_first_reaction_should_be": "...",
}
Stage Three: Advanced (4-6 months, target 250+ problems)
Prerequisites: Medium solve rate > 70% (within 45 minutes)
Goal: Solve Hard problems, master advanced data structures and algorithms
| Topic | Problems | Book Chapters |
|---|---|---|
| Segment Trees / BITs | 10 | Ch. 33 |
| Advanced DP (bitmask, digit, tree-shaped) | 15 | Ch. 29-30 |
| Advanced Graph (network flow, bipartite) | 10 | Ch. 23-24 |
| Advanced Strings (KMP, suffix arrays) | 8 | Ch. 34 |
| Advanced Data Structures (Union-Find, Trie variants) | 10 | Ch. 7, 10 |
| Mathematics (number theory, combinatorics, probability) | 10 | Ch. 32 |
| Mixed Hard problems | 30 | โ |
Stage Four: Competitive Programming (6+ months)
Prerequisites: Hard solve rate > 50%
Goal: Top 5% on LeetCode weekly contests, or Codeforces rating > 1800
The training approach for competitive programming differs fundamentally from interview preparation:
COMPETITION_TRAINING = {
"frequency": "1-2 hours daily + at least 1 contest per week",
"content": {
"virtual_contests": "Simulate real contest conditions on LeetCode/Codeforces",
"targeted_practice": "Focus on weaknesses (e.g., DP marathon, graph theory sprint)",
"upsolving": "After each contest, solve every problem you missed and understand it",
},
"competition_specific_skills": [
"Fast coding (pre-built templates)",
"Precise complexity estimation (judge feasibility in 1-2 seconds)",
"Mathematical derivation ability",
"Handling large numbers (modular arithmetic, overflow prevention)",
],
"career_value": "Competitive programming experience is highly valued at Google/Meta/etc.",
}
1.2 Curated 200-Problem List
The following list is derived from the intersection of Blind75, NeetCode150, and Grind75, reorganized by this book's chapter structure. Each problem is annotated with difficulty (E/M/H) and interview frequency (1-5 stars).
Arrays and Two Pointers (20 problems)
ARRAY_TWO_POINTERS = [
# (Number, Name, Difficulty, Frequency, Key Technique)
(1, "Two Sum", "E", "โ
โ
โ
โ
โ
", "Hash map O(n)"),
(15, "3Sum", "M", "โ
โ
โ
โ
โ
", "Sort + opposing pointers"),
(11, "Container With Most Water", "M", "โ
โ
โ
โ
", "Opposing pointers + greedy"),
(42, "Trapping Rain Water", "H", "โ
โ
โ
โ
โ
", "Two pointers / monotonic stack / DP"),
(26, "Remove Duplicates", "E", "โ
โ
โ
", "Same-direction two pointers"),
(283, "Move Zeroes", "E", "โ
โ
โ
โ
", "Same-direction two pointers"),
(167, "Two Sum II (Sorted)", "M", "โ
โ
โ
", "Opposing pointers"),
(125, "Valid Palindrome", "E", "โ
โ
โ
", "Opposing pointers"),
(238, "Product Except Self", "M", "โ
โ
โ
โ
", "Prefix/suffix products"),
(53, "Maximum Subarray", "M", "โ
โ
โ
โ
โ
", "Kadane / prefix sums"),
(121, "Best Time Buy/Sell Stock", "E", "โ
โ
โ
โ
โ
", "Track prefix minimum"),
(152, "Maximum Product Subarray", "M", "โ
โ
โ
โ
", "Track both max and min"),
(33, "Search Rotated Array", "M", "โ
โ
โ
โ
โ
", "Modified binary search"),
(153, "Find Min Rotated Array", "M", "โ
โ
โ
โ
", "Binary search"),
(4, "Median of Two Sorted", "H", "โ
โ
โ
โ
", "Binary search O(log(m+n))"),
(54, "Spiral Matrix", "M", "โ
โ
โ
", "Simulation + boundary tracking"),
(48, "Rotate Image", "M", "โ
โ
โ
", "Transpose + flip"),
(73, "Set Matrix Zeroes", "M", "โ
โ
โ
", "Use first row/col as markers"),
(128, "Longest Consecutive Seq", "M", "โ
โ
โ
โ
", "Hash set"),
(56, "Merge Intervals", "M", "โ
โ
โ
โ
โ
", "Sort + merge"),
]
Sliding Window (10 problems)
SLIDING_WINDOW = [
(3, "Longest Substring No Repeat", "M", "โ
โ
โ
โ
โ
", "Hash set + shrink"),
(76, "Minimum Window Substring", "H", "โ
โ
โ
โ
โ
", "Hash counter + shrink"),
(424, "Longest Repeating Replacement","M", "โ
โ
โ
โ
", "Fixed-length mindset"),
(567, "Permutation in String", "M", "โ
โ
โ
โ
", "Fixed window + counter"),
(209, "Min Size Subarray Sum", "M", "โ
โ
โ
", "Variable window"),
(904, "Fruit Into Baskets", "M", "โ
โ
โ
", "At most k distinct chars"),
(438, "Find All Anagrams", "M", "โ
โ
โ
โ
", "Fixed window + counter"),
(30, "Substring Concat Words", "H", "โ
โ
โ
", "Fixed-length window"),
(239, "Sliding Window Maximum", "H", "โ
โ
โ
โ
", "Monotonic deque"),
(395, "Longest Substr K Repeating", "M", "โ
โ
โ
", "Divide and conquer / window"),
]
Linked Lists (10 problems)
LINKED_LIST = [
(206, "Reverse Linked List", "E", "โ
โ
โ
โ
โ
", "Three-pointer iteration"),
(21, "Merge Two Sorted Lists", "E", "โ
โ
โ
โ
โ
", "Dummy head + compare"),
(141, "Linked List Cycle", "E", "โ
โ
โ
โ
โ
", "Fast/slow pointers"),
(142, "Linked List Cycle II", "M", "โ
โ
โ
โ
", "Fast/slow + math"),
(19, "Remove Nth From End", "M", "โ
โ
โ
โ
", "Fast/slow pointers"),
(143, "Reorder List", "M", "โ
โ
โ
โ
", "Find middle + reverse + merge"),
(23, "Merge K Sorted Lists", "H", "โ
โ
โ
โ
โ
", "Heap / divide-and-conquer"),
(25, "Reverse Nodes k-Group", "H", "โ
โ
โ
โ
", "Group reversal"),
(138, "Copy List Random Pointer", "M", "โ
โ
โ
โ
", "Hash map / interweaving"),
(148, "Sort List", "M", "โ
โ
โ
", "Merge sort"),
]
Stacks and Queues (10 problems)
STACK_QUEUE = [
(20, "Valid Parentheses", "E", "โ
โ
โ
โ
โ
", "Stack matching"),
(155, "Min Stack", "M", "โ
โ
โ
โ
", "Auxiliary stack"),
(150, "Eval Reverse Polish", "M", "โ
โ
โ
", "Stack evaluation"),
(739, "Daily Temperatures", "M", "โ
โ
โ
โ
", "Monotonic decreasing stack"),
(84, "Largest Rect Histogram", "H", "โ
โ
โ
โ
โ
", "Monotonic stack"),
(496, "Next Greater Element I", "E", "โ
โ
โ
", "Monotonic stack + hash"),
(503, "Next Greater Element II", "M", "โ
โ
โ
", "Monotonic stack + circular"),
(394, "Decode String", "M", "โ
โ
โ
โ
", "Stack / recursion"),
(232, "Implement Queue using Stacks", "E", "โ
โ
โ
", "Two stacks"),
(85, "Maximal Rectangle", "H", "โ
โ
โ
โ
", "Monotonic stack + prefix"),
]
Trees (20 problems)
TREES = [
(104, "Maximum Depth", "E", "โ
โ
โ
โ
โ
", "Recursion / BFS"),
(226, "Invert Binary Tree", "E", "โ
โ
โ
โ
", "Recursion"),
(100, "Same Tree", "E", "โ
โ
โ
", "Recursive comparison"),
(572, "Subtree of Another Tree", "E", "โ
โ
โ
", "Recursion + same-tree check"),
(102, "Level Order Traversal", "M", "โ
โ
โ
โ
โ
", "BFS"),
(105, "Construct from Pre+In", "M", "โ
โ
โ
โ
", "Recursive divide-and-conquer"),
(230, "Kth Smallest in BST", "M", "โ
โ
โ
โ
", "In-order traversal"),
(98, "Validate BST", "M", "โ
โ
โ
โ
โ
", "In-order / range recursion"),
(235, "LCA of BST", "M", "โ
โ
โ
โ
", "BST property"),
(236, "LCA of Binary Tree", "M", "โ
โ
โ
โ
โ
", "Post-order recursion"),
(124, "Binary Tree Max Path Sum", "H", "โ
โ
โ
โ
โ
", "Post-order + global variable"),
(297, "Serialize/Deserialize", "H", "โ
โ
โ
โ
", "BFS / pre-order"),
(543, "Diameter of Binary Tree", "E", "โ
โ
โ
โ
", "Post-order depth"),
(199, "Right Side View", "M", "โ
โ
โ
โ
", "BFS last of each level"),
(114, "Flatten to Linked List", "M", "โ
โ
โ
", "Post-order / Morris"),
(437, "Path Sum III", "M", "โ
โ
โ
โ
", "Prefix sum + DFS"),
(208, "Implement Trie", "M", "โ
โ
โ
โ
โ
", "Trie node structure"),
(211, "Add/Search Word", "M", "โ
โ
โ
โ
", "Trie + DFS"),
(212, "Word Search II", "H", "โ
โ
โ
โ
", "Trie + backtracking"),
(295, "Find Median Data Stream", "H", "โ
โ
โ
โ
โ
", "Two heaps"),
]
Graphs (15 problems)
GRAPH = [
(200, "Number of Islands", "M", "โ
โ
โ
โ
โ
", "BFS / DFS"),
(133, "Clone Graph", "M", "โ
โ
โ
โ
", "BFS/DFS + hash map"),
(695, "Max Area of Island", "M", "โ
โ
โ
โ
", "DFS"),
(417, "Pacific Atlantic Water", "M", "โ
โ
โ
โ
", "Reverse BFS"),
(207, "Course Schedule", "M", "โ
โ
โ
โ
โ
", "Topological sort"),
(210, "Course Schedule II", "M", "โ
โ
โ
โ
", "Topological + output order"),
(261, "Graph Valid Tree", "M", "โ
โ
โ
โ
", "Union-Find / BFS"),
(323, "Connected Components", "M", "โ
โ
โ
", "Union-Find / DFS"),
(127, "Word Ladder", "H", "โ
โ
โ
โ
", "BFS"),
(269, "Alien Dictionary", "H", "โ
โ
โ
โ
", "Topological sort"),
(743, "Network Delay Time", "M", "โ
โ
โ
โ
", "Dijkstra"),
(787, "Cheapest Flights K Stops", "M", "โ
โ
โ
โ
", "BFS / Bellman-Ford"),
(332, "Reconstruct Itinerary", "H", "โ
โ
โ
", "Hierholzer"),
(684, "Redundant Connection", "M", "โ
โ
โ
โ
", "Union-Find"),
(994, "Rotting Oranges", "M", "โ
โ
โ
โ
", "Multi-source BFS"),
]
Backtracking (10 problems)
BACKTRACKING = [
(78, "Subsets", "M", "โ
โ
โ
โ
โ
", "Include / exclude"),
(90, "Subsets II", "M", "โ
โ
โ
โ
", "Deduplication"),
(39, "Combination Sum", "M", "โ
โ
โ
โ
โ
", "Reusable elements"),
(40, "Combination Sum II", "M", "โ
โ
โ
โ
", "No reuse + dedup"),
(46, "Permutations", "M", "โ
โ
โ
โ
โ
", "Full permutation"),
(47, "Permutations II", "M", "โ
โ
โ
โ
", "Dedup permutation"),
(79, "Word Search", "M", "โ
โ
โ
โ
", "Grid backtracking"),
(51, "N-Queens", "H", "โ
โ
โ
โ
", "Classic backtracking"),
(17, "Letter Combinations Phone", "M", "โ
โ
โ
โ
", "Multi-branch tree"),
(131, "Palindrome Partitioning", "M", "โ
โ
โ
โ
", "Backtrack + palindrome check"),
]
Dynamic Programming (30 problems)
DYNAMIC_PROGRAMMING = [
# 1D DP
(70, "Climbing Stairs", "E", "โ
โ
โ
โ
โ
", "Fibonacci"),
(198, "House Robber", "M", "โ
โ
โ
โ
โ
", "Include / exclude"),
(213, "House Robber II", "M", "โ
โ
โ
โ
", "Circular DP"),
(322, "Coin Change", "M", "โ
โ
โ
โ
โ
", "Unbounded knapsack"),
(139, "Word Break", "M", "โ
โ
โ
โ
โ
", "String DP"),
(300, "Longest Increasing Subseq", "M", "โ
โ
โ
โ
โ
", "LIS classic"),
(416, "Partition Equal Subset", "M", "โ
โ
โ
โ
", "0-1 knapsack"),
(91, "Decode Ways", "M", "โ
โ
โ
โ
", "Linear DP"),
# 2D DP
(62, "Unique Paths", "M", "โ
โ
โ
โ
", "Grid DP"),
(64, "Minimum Path Sum", "M", "โ
โ
โ
โ
", "Grid DP"),
(1143, "Longest Common Subseq", "M", "โ
โ
โ
โ
โ
", "LCS classic"),
(72, "Edit Distance", "H", "โ
โ
โ
โ
โ
", "String DP"),
(10, "Regular Expression Match", "H", "โ
โ
โ
โ
", "String DP"),
(97, "Interleaving String", "M", "โ
โ
โ
", "2D DP"),
(115, "Distinct Subsequences", "H", "โ
โ
โ
", "2D DP"),
# Interval / State DP
(5, "Longest Palindromic Substr", "M", "โ
โ
โ
โ
โ
", "Interval DP / Manacher"),
(516, "Longest Palindromic Subseq", "M", "โ
โ
โ
โ
", "Interval DP"),
(312, "Burst Balloons", "H", "โ
โ
โ
โ
", "Interval DP"),
(1547, "Min Cost Cut Stick", "H", "โ
โ
โ
", "Interval DP"),
# Knapsack / Bitmask
(494, "Target Sum", "M", "โ
โ
โ
โ
", "0-1 knapsack variant"),
(518, "Coin Change 2", "M", "โ
โ
โ
โ
", "Unbounded knapsack"),
(474, "Ones and Zeroes", "M", "โ
โ
โ
", "2D knapsack"),
(377, "Combination Sum IV", "M", "โ
โ
โ
", "Permutation knapsack"),
# Stock Series
(121, "Best Time I", "E", "โ
โ
โ
โ
โ
", "Single transaction"),
(122, "Best Time II", "M", "โ
โ
โ
โ
", "Unlimited transactions"),
(123, "Best Time III", "H", "โ
โ
โ
โ
", "At most two transactions"),
(188, "Best Time IV", "H", "โ
โ
โ
", "At most k transactions"),
(309, "Best Time Cooldown", "M", "โ
โ
โ
โ
", "State machine DP"),
(714, "Best Time Fee", "M", "โ
โ
โ
", "State machine DP"),
# Other
(152, "Maximum Product Subarray", "M", "โ
โ
โ
โ
", "Track pos/neg separately"),
]
Greedy (10 problems)
GREEDY = [
(55, "Jump Game", "M", "โ
โ
โ
โ
โ
", "Farthest reachable"),
(45, "Jump Game II", "M", "โ
โ
โ
โ
", "BFS thinking"),
(134, "Gas Station", "M", "โ
โ
โ
โ
", "Cumulative sum check"),
(846, "Hand of Straights", "M", "โ
โ
โ
", "Sort + greedy"),
(763, "Partition Labels", "M", "โ
โ
โ
โ
", "Farthest occurrence"),
(435, "Non-overlapping Intervals", "M", "โ
โ
โ
โ
", "Interval greedy"),
(621, "Task Scheduler", "M", "โ
โ
โ
โ
", "Bucket approach"),
(452, "Min Arrows Burst Balloons", "M", "โ
โ
โ
", "Interval greedy"),
(1899, "Merge Triplets Target", "M", "โ
โ
โ
", "Per-element greedy"),
(678, "Valid Parenthesis String", "M", "โ
โ
โ
โ
", "Range greedy"),
]
Bit Manipulation and Math (10 problems)
BIT_MATH = [
(136, "Single Number", "E", "โ
โ
โ
โ
โ
", "XOR"),
(191, "Number of 1 Bits", "E", "โ
โ
โ
", "n & (n-1)"),
(338, "Counting Bits", "E", "โ
โ
โ
โ
", "DP + bit manipulation"),
(268, "Missing Number", "E", "โ
โ
โ
โ
", "XOR / math"),
(190, "Reverse Bits", "E", "โ
โ
โ
", "Bit-by-bit"),
(371, "Sum of Two Integers", "M", "โ
โ
โ
", "Bitwise addition"),
(7, "Reverse Integer", "M", "โ
โ
โ
", "Modulo"),
(50, "Pow(x, n)", "M", "โ
โ
โ
โ
", "Fast exponentiation"),
(43, "Multiply Strings", "M", "โ
โ
โ
", "Simulate multiplication"),
(202, "Happy Number", "E", "โ
โ
โ
", "Fast/slow pointer / set"),
]
Design Problems (15 problems)
DESIGN = [
(146, "LRU Cache", "M", "โ
โ
โ
โ
โ
", "Hash map + doubly linked list"),
(460, "LFU Cache", "H", "โ
โ
โ
โ
", "Two hash maps + linked list"),
(380, "Insert Delete GetRandom", "M", "โ
โ
โ
โ
", "Array + hash map"),
(355, "Design Twitter", "M", "โ
โ
โ
โ
", "Heap + hash map"),
(295, "Find Median Stream", "H", "โ
โ
โ
โ
โ
", "Two heaps"),
(703, "Kth Largest in Stream", "E", "โ
โ
โ
", "Min-heap of size k"),
(1396, "Design Underground", "M", "โ
โ
โ
", "Two hash maps"),
(588, "Design In-Memory FS", "H", "โ
โ
โ
", "Trie"),
(362, "Design Hit Counter", "M", "โ
โ
โ
โ
", "Queue / bucket"),
(341, "Flatten Nested List Iterator", "M", "โ
โ
โ
", "Stack"),
(895, "Maximum Frequency Stack", "H", "โ
โ
โ
โ
", "Hash map + stack group"),
(432, "All O(1) Data Structure", "H", "โ
โ
โ
", "Doubly linked list + hash"),
(716, "Max Stack", "H", "โ
โ
โ
", "Doubly linked list + TreeMap"),
(622, "Design Circular Queue", "M", "โ
โ
โ
", "Array + two pointers"),
(981, "Time Based Key-Value", "M", "โ
โ
โ
โ
", "Hash map + binary search"),
]
1.3 Spaced Repetition Method
The forgetting curve (Ebbinghaus, 1885) tells us: without review, you forget 70% within 24 hours and 90% within one week.
Spaced repetition strategy for algorithm practice:
from datetime import datetime, timedelta
class SpacedRepetition:
"""Spaced repetition system for algorithm problems.
Simplified version of the SM-2 algorithm (SuperMemo, Wozniak 1987).
"""
INTERVALS = [1, 3, 7, 14, 30, 60] # Review intervals in days
def __init__(self):
self.problems = {} # problem_id -> {level, next_review, ...}
def record_attempt(self, problem_id: str, solved_independently: bool,
time_minutes: int):
"""Record one problem attempt."""
if problem_id not in self.problems:
self.problems[problem_id] = {"level": 0, "attempts": 0}
prob = self.problems[problem_id]
prob["attempts"] += 1
prob["last_attempt"] = datetime.now()
if solved_independently and time_minutes <= 45:
# Solved -> advance to longer interval
prob["level"] = min(prob["level"] + 1, len(self.INTERVALS) - 1)
else:
# Failed -> reset to shortest interval
prob["level"] = 0
interval = self.INTERVALS[prob["level"]]
prob["next_review"] = datetime.now() + timedelta(days=interval)
def get_due_problems(self) -> list:
"""Get problems due for review today."""
today = datetime.now()
due = []
for pid, info in self.problems.items():
if info.get("next_review", today) <= today:
due.append(pid)
return due
def get_study_plan(self, available_hours: float) -> dict:
"""Generate a study plan based on available time."""
due = self.get_due_problems()
problems_per_hour = 2 # conservative estimate
total_slots = int(available_hours * problems_per_hour)
review_slots = min(len(due), total_slots // 3) # 1/3 of time on review
new_slots = total_slots - review_slots # 2/3 of time on new problems
return {
"review_problems": due[:review_slots],
"new_problem_count": new_slots,
"suggestion": f"Today: {review_slots} review + {new_slots} new problems",
}
1.4 Common Mistakes at a Glance
Mistake 1: Too many problems, too fast
# BAD: "I do 10 problems a day, 300 in a month"
# Problem: spending 10 minutes per problem, forgetting immediately. Equivalent to zero.
# GOOD: "I do 2-3 problems a day, 45 minutes each, with written summaries"
# Result: 200 problems in 3 months, each truly mastered.
Mistake 2: Grinding without thinking
# BAD workflow:
# Read problem -> no idea -> read editorial -> "oh I see" -> next problem
#
# This is not learning. This is watching television.
# GOOD workflow:
# Read problem -> try for 15 min -> truly stuck -> read ONLY the hint (not full solution)
# -> try 15 more min -> still stuck -> read editorial
# -> close editorial and rewrite from memory -> redo it the next day
Level 2 ยท How It Works Under the Hood
2.1 The Scientific Basis of Deliberate Practice
Why is random grinding inefficient?
Ericsson et al. (1993, "The Role of Deliberate Practice in the Acquisition of Expert Performance") demonstrated that simple repetition does not produce improvement. Progress requires deliberate practice, which has four components:
- Clear goal: "Today I will master the variable-length sliding window pattern" vs. "I will do some problems today"
- Appropriate difficulty: Too easy gives no growth, too hard causes frustration. Sweet spot: problems you solve 50-70% of the time
- Immediate feedback: Check correctness immediately after solving, compare with optimal
- Focused repetition: Do 5-8 problems of the same type consecutively to build pattern recognition
def deliberate_practice_session(target_pattern: str, duration_hours: float = 2):
"""One deliberate practice training unit."""
# 1. Define the session goal
goal = f"Master the core template and 3 variations of {target_pattern}"
# 2. Select problems at appropriate difficulty
problems = select_problems(
pattern=target_pattern,
difficulty="Medium", # current level -1 to +1
count=5
)
# 3. Solve + get immediate feedback
for problem in problems:
attempt = solve(problem, time_limit=45)
# Immediate feedback
if attempt.is_correct():
compare_with_optimal(attempt) # Is there a better solution?
else:
identify_failure_point(attempt) # Where exactly did you get stuck?
# Extract the pattern
record_pattern_note(problem, target_pattern)
# 4. Session summary
session_summary = {
"target_pattern": target_pattern,
"problems_attempted": len(problems),
"solved_independently": count_solved_independently,
"key_takeaway": "...",
"needs_reinforcement": "...",
}
return session_summary
2.2 From "Solving Problems" to "Writing Production Code"
After passing interviews, your daily work involves writing production code โ which differs from LeetCode code in fundamental ways:
| Dimension | LeetCode Code | Production Code |
|---|---|---|
| Lifespan | Never looked at again after submission | Maintained for 3-5 years |
| Audience | Only yourself | Your entire team |
| Input | Guaranteed valid by the problem | Any input is possible |
| Error handling | Essentially none | A core concern |
| Testing | Online judge decides | You write the tests |
| Naming | dp[i][j] is fine |
Must be self-documenting |
| Documentation | Not needed | Key decisions require comments |
Code Style Transformation Example
# ========== LeetCode Style ==========
def maxProfit(prices):
dp = [[0]*2 for _ in range(len(prices))]
dp[0][0] = 0
dp[0][1] = -prices[0]
for i in range(1, len(prices)):
dp[i][0] = max(dp[i-1][0], dp[i-1][1] + prices[i])
dp[i][1] = max(dp[i-1][1], dp[i-1][0] - prices[i])
return dp[-1][0]
# ========== Production Style ==========
from typing import List
from dataclasses import dataclass
@dataclass
class TradingState:
"""The trading state at the end of a given day."""
max_profit_without_stock: int # Maximum profit when not holding
max_profit_with_stock: int # Maximum profit when holding
def calculate_max_profit(daily_prices: List[int]) -> int:
"""Calculate the maximum profit from unlimited transactions (no fee).
Uses state-machine DP: each day has two states โ holding and not holding.
Args:
daily_prices: List of daily stock prices, length >= 1, each value >= 0
Returns:
The maximum total profit achievable
Raises:
ValueError: If daily_prices is empty
Examples:
>>> calculate_max_profit([7, 1, 5, 3, 6, 4])
7
>>> calculate_max_profit([1, 2, 3, 4, 5])
4
Time: O(n), Space: O(1)
"""
if not daily_prices:
raise ValueError("daily_prices must not be empty")
state = TradingState(
max_profit_without_stock=0,
max_profit_with_stock=-daily_prices[0]
)
for price in daily_prices[1:]:
new_without = max(
state.max_profit_without_stock,
state.max_profit_with_stock + price # sell
)
new_with = max(
state.max_profit_with_stock,
state.max_profit_without_stock - price # buy
)
state = TradingState(
max_profit_without_stock=new_without,
max_profit_with_stock=new_with
)
return state.max_profit_without_stock
Readability Principles
# Principle 1: Variable names convey intent
# BAD
n, m, k = len(grid), len(grid[0]), target
# GOOD
num_rows, num_cols, target_sum = len(grid), len(grid[0]), target
# Principle 2: Extract complex conditions into functions
# BAD
if node and node.left and node.left.val == node.val and node.right and node.right.val == node.val:
pass
# GOOD
def both_children_match(node):
"""Check whether both children have the same value as the parent."""
if not node or not node.left or not node.right:
return False
return node.left.val == node.val == node.right.val
if both_children_match(node):
pass
# Principle 3: Use early returns to reduce nesting
# BAD
def process(data):
if data:
if validate(data):
if transform(data):
return result
return None
# GOOD
def process(data):
if not data:
return None
if not validate(data):
return None
if not transform(data):
return None
return result
Testability Principles
# BAD: Untestable โ depends on global state
visited = set()
def dfs(node):
if node in visited:
return
visited.add(node)
for neighbor in node.neighbors:
dfs(neighbor)
# GOOD: Testable โ dependency injection
def dfs(node, visited: set = None) -> set:
"""DFS traversal, returns all visited nodes.
Args:
node: Starting node
visited: Already-visited set (injectable for testing)
Returns:
Set of all visited nodes
"""
if visited is None:
visited = set()
if node in visited:
return visited
visited.add(node)
for neighbor in node.neighbors:
dfs(neighbor, visited)
return visited
# Tests
def test_dfs_simple_graph():
"""Test DFS on a simple connected graph."""
# Arrange
a, b, c = Node("a"), Node("b"), Node("c")
a.neighbors = [b, c]
b.neighbors = [a]
c.neighbors = [a]
# Act
result = dfs(a)
# Assert
assert result == {a, b, c}
def test_dfs_disconnected():
"""Test DFS does not reach disconnected nodes."""
a, b = Node("a"), Node("b")
# a and b are not connected
result = dfs(a)
assert result == {a}
assert b not in result
2.3 Common Code Review Issues
Once employed, your code will be reviewed. Here are habits from competitive programming that trip up new hires:
CODE_REVIEW_ISSUES = {
"single_letter_variables": {
"problem": "i, j, k, n, m are fine on LeetCode but not in production",
"exception": "Loop variable i is fine; but nested loops need descriptive outer names",
},
"missing_type_annotations": {
"problem": "def solve(arr, k) โ what types? What semantics?",
"fix": "def find_kth_largest(nums: list[int], k: int) -> int",
},
"magic_numbers": {
"problem": "if n > 1000000007",
"fix": "MOD = 10**9 + 7; if n > MOD",
},
"missing_error_handling": {
"problem": "Assumes input is always valid",
"fix": "Add parameter validation and exception handling",
},
"premature_optimization_over_readability": {
"problem": "Using bit shifts instead of simple division (bonus in interviews, penalty in production)",
"fix": "Unless it is a performance-critical hot path, use the clear version",
},
"missing_documentation": {
"problem": "Time/space complexity of algorithms, why this algorithm was chosen",
"fix": "Docstring explaining the rationale behind algorithm selection",
},
}
2.4 Bridging Interview Code and Production Code
# Interview code (fast, concise, proves you know the algorithm)
def merge_intervals(intervals):
intervals.sort(key=lambda x: x[0])
merged = [intervals[0]]
for s, e in intervals[1:]:
if s <= merged[-1][1]:
merged[-1][1] = max(merged[-1][1], e)
else:
merged.append([s, e])
return merged
# Same algorithm, production-quality version
from dataclasses import dataclass
from typing import List
@dataclass(frozen=True, order=True)
class Interval:
"""Represents a time interval [start, end]."""
start: int
end: int
def __post_init__(self):
if self.start > self.end:
raise ValueError(f"Invalid interval: start ({self.start}) > end ({self.end})")
def overlaps_or_adjacent(self, other: 'Interval') -> bool:
"""Check whether two intervals overlap or are adjacent."""
return self.start <= other.end and other.start <= self.end
def merge_with(self, other: 'Interval') -> 'Interval':
"""Merge two overlapping intervals."""
if not self.overlaps_or_adjacent(other):
raise ValueError(f"Cannot merge non-overlapping intervals: {self}, {other}")
return Interval(min(self.start, other.start), max(self.end, other.end))
def merge_overlapping_intervals(intervals: List[Interval]) -> List[Interval]:
"""Merge all overlapping time intervals.
Algorithm: sort then linear-scan merge (same as the interview solution).
Args:
intervals: List of intervals to merge
Returns:
Merged interval list (sorted by start, no overlaps)
Time: O(n log n) dominated by sorting
Space: O(n) for storing results
Examples:
>>> merge_overlapping_intervals([Interval(1,3), Interval(2,6), Interval(8,10)])
[Interval(start=1, end=6), Interval(start=8, end=10)]
"""
if not intervals:
return []
sorted_intervals = sorted(intervals) # dataclass order=True sorts by start
merged = [sorted_intervals[0]]
for current in sorted_intervals[1:]:
last_merged = merged[-1]
if last_merged.overlaps_or_adjacent(current):
merged[-1] = last_merged.merge_with(current)
else:
merged.append(current)
return merged
2.5 Where Algorithms Appear in Daily Engineering
You will not write sorting algorithms every day, but algorithmic thinking is everywhere:
DAILY_ALGORITHM_USAGE = {
"frontend_performance": {
"scenario": "Virtual list only renders the visible region",
"algorithm": "Binary search to locate visible range start/end",
},
"backend_rate_limiting": {
"scenario": "API allows at most 100 requests per second",
"algorithm": "Sliding window / token bucket",
},
"search_suggestions": {
"scenario": "Show autocomplete suggestions as user types",
"algorithm": "Trie + DFS for prefix matching",
},
"log_analysis": {
"scenario": "Find the 10 most-visited IPs in the past hour",
"algorithm": "Hash counter + min-heap Top-K",
},
"task_scheduling": {
"scenario": "Cron tasks executed by priority",
"algorithm": "Priority queue",
},
"data_deduplication": {
"scenario": "Message queue consumer idempotency",
"algorithm": "Bloom filter for fast pre-check + DB unique constraint as fallback",
},
"cache_design": {
"scenario": "Hot data cache eviction",
"algorithm": "LRU / LFU",
},
"config_matching": {
"scenario": "Route rule matching (/api/v1/users/:id)",
"algorithm": "Trie + wildcard matching",
},
}
Level 3 ยท How the Standards Are Defined
3.1 The Science of Learning Efficiency
Active Recall vs. Passive Review:
Karpicke & Roediger (2008, "The Critical Importance of Retrieval Practice for Learning", Science) conducted an experiment:
- Group A: Read the material 4 times
- Group B: Read once + attempted recall 3 times
- One-week test: Group B retained 1.5x more than Group A
Implications for algorithm practice:
- Reading editorials = passive review = low efficiency
- Closing the editorial and rewriting = active recall = high efficiency
- Re-solving without looking the next day = spaced recall = highest efficiency
Interleaving vs. Blocking:
Rohrer & Taylor (2007) found:
- Blocking: AAABBBCCC (same type in sequence)
- Interleaving: ABCABCABC (mixed types)
- Short-term performance: blocking wins (same-day test)
- Long-term retention: interleaving wins (one-week test, 43% better)
def optimal_study_schedule(available_days: int, target_problems: int) -> dict:
"""Cognitive-science-based optimal study plan.
Research sources:
- Ericsson (1993): Deliberate practice maxes out at ~4 effective hours/day
- Karpicke (2008): Active recall > passive review
- Rohrer (2007): Interleaving > blocking for long-term retention
- Ebbinghaus (1885): Spaced repetition combats forgetting
"""
daily_effective_hours = 2.5 # conservative (including breaks)
problems_per_day = 3 # high-quality solving (including analysis, rewriting)
schedule = {
"daily_time_allocation": {
"new_problems": "1.5 hours (2-3 problems, including analysis)",
"review": "0.5 hours (2-3 due problems from past sessions)",
"summary": "0.5 hours (write notes, update pattern library)",
},
"weekly_structure": {
"monday_to_friday": "Normal study",
"saturday": "Mock interview (timed: 2 problems)",
"sunday": "Weekly review (redo all failed problems from the week)",
},
"progress_tracking": {
"beginner_to_intermediate": f"~{50 // problems_per_day} days",
"intermediate_to_advanced": f"~{100 // problems_per_day} days",
"total": f"~{target_problems // problems_per_day} days",
},
}
return schedule
3.2 Design Principles Behind the 200-Problem List
The 200-problem list in Section 1.2 was designed according to these principles:
Principle 1: Cover all high-frequency patterns
# Each pattern needs at least 10 problems to ensure sufficient repetition.
# Cognitive psychology: a pattern requires 7-10 exposures to become stable.
COVERAGE_REQUIREMENT = {
"array_two_pointers": 20, # highest frequency
"dynamic_programming": 30, # greatest depth
"trees": 20, # always tested in interviews
"graphs": 15, # Medium-Hard territory
"backtracking": 10, # clear template
"sliding_window": 10, # clear template
"linked_list": 10, # foundational
"stack_queue": 10, # monotonic stack is the hard part
"greedy": 10, # proof is the hard part
"bit_math": 10, # supplementary
"design": 15, # integrative
}
# Total: 160 core + 40 supplementary = 200
Principle 2: Progressive difficulty
Within each category, problems are ordered Easy -> Medium -> Hard. The first problem is always a template problem (directly maps to the pattern), while the last few are variations (require reasoning about how to reduce to a known pattern).
Principle 3: Frequency first
5-star problems = asked by virtually every major company (or a close variant). You must reach the level of "I see this and immediately know the approach."
3.3 Customized Paths for Different Goals
Interview-Focused (Shortest Path)
INTERVIEW_FOCUSED_PATH = {
"total_time": "2-3 months",
"total_problems": "100-150",
"strategy": "Only do 4-5 star frequency problems, skip competition-only topics",
"priorities": {
"must_do": ["Two pointers", "Sliding window", "BFS/DFS", "Basic DP", "Trees", "Design"],
"optional": ["Greedy", "Advanced graph", "Bit manipulation"],
"skip": ["Segment trees", "Suffix arrays", "Network flow", "Digit DP"],
},
"milestones": {
"month_1": "Easy 90%+ solve rate, Medium 50%",
"month_2": "Medium 70%+ solve rate",
"month_3": "Mock interview pass rate > 60%",
},
}
Deep Learning Path (for readers of this book)
DEEP_LEARNING_PATH = {
"total_time": "6-12 months",
"total_problems": "300+",
"strategy": "Follow this book's chapter order, solve corresponding problems after each chapter",
"characteristics": {
"do_not_skip_theory": "Read the full chapter before solving problems",
"understanding_first": "For every problem, be able to explain WHY this algorithm works",
"engineering_oriented": "Write unit tests for every solution",
},
"per_chapter_workflow": [
"1. Read the corresponding book chapter (1-2 hours)",
"2. Solve 5-8 problems for that chapter (2-3 hours)",
"3. Write summary notes: core idea, applicability conditions, common variations",
"4. One week later: redo failed problems without notes",
],
}
Competition Path
COMPETITION_PATH = {
"total_time": "12+ months",
"platforms": ["Codeforces", "AtCoder", "LeetCode Contest"],
"stages": {
"foundation_3mo": "Consistently solve Codeforces Div.2 A-C",
"growth_3mo": "Can solve Div.2 D / Div.1 A",
"advanced_6mo_plus": "Have ideas for Div.1 B-C",
},
"competition_specific_training": [
"Number theory (modular arithmetic, prime factorization, Euler's totient)",
"Combinatorics (Catalan numbers, inclusion-exclusion)",
"Computational geometry (convex hull, closest pair)",
"Advanced data structures (persistent, CDQ divide-and-conquer)",
"String algorithms (SAM, palindrome automaton)",
],
}
3.4 How to Assess Your Own Level
SKILL_ASSESSMENT = {
"beginner": {
"easy_solve_rate": "> 80%",
"average_time": "< 20 minutes",
"indicator": "Seeing an Easy problem triggers an immediate first reaction",
},
"intermediate": {
"medium_solve_rate": "> 70% (within 45 minutes)",
"average_time": "< 30 minutes",
"indicator": "Can identify most problem patterns and know which algorithm to use",
},
"advanced": {
"hard_solve_rate": "> 40% (within 60 minutes)",
"indicator": "Can reduce unfamiliar problems to known problems",
"system_design": "Can handle Level 2 depth (requires combining algorithm knowledge)",
},
"competitive": {
"indicator": "LeetCode weekly contest top 100 / Codeforces 1800+",
"characteristic": "Has seen enough pattern variations that intuition is strong",
},
}
3.5 Recommended Learning Tools
RECOMMENDED_TOOLS = {
"practice_platforms": {
"LeetCode": "Most comprehensive interview problem bank, supports English and Chinese",
"Codeforces": "Best for competitive training, accurate difficulty ratings",
"AtCoder": "Japanese contest platform, extremely high problem quality",
},
"visualization": {
"VisuAlgo": "Data structure and algorithm animations (NUS Singapore)",
"Algorithm Visualizer": "Custom code visualization and execution",
"Python Tutor": "Step-by-step Python execution visualization",
},
"recording_and_review": {
"Anki": "General spaced-repetition tool, create algorithm flashcards",
"Notion/Obsidian": "Build a personal algorithm knowledge base",
"Git repo": "Store all solutions in a private repo for easy search",
},
"mock_interviews": {
"Pramp": "Free peer mock interviews",
"Interviewing.io": "Practice with real interviewers",
"Self-recording": "Screen + audio recording, replay to analyze your performance",
},
}
Level 4 ยท Boundaries and Pitfalls
4.1 Common Learning Mistakes
Mistake 1: Grinding without thinking ("brute-force studying")
# Symptoms:
# - Solved 500 problems but still failing interviews
# - Cannot solve the same problem after a month away
# - First reaction to a new problem is "I have not seen this one before"
# instead of "this looks like pattern XX"
# Root cause:
# You are building a "problem -> answer" mapping (memorization)
# Instead of a "features -> pattern -> template" mapping (understanding)
# Fix:
def proper_study_after_solving(problem, my_solution):
"""The correct follow-up steps after every problem."""
# 1. Classify: what pattern does this problem belong to?
pattern = classify(problem)
# 2. Extract: what is the generic template for this pattern?
template = extract_template(pattern)
# 3. Variations: how does this problem differ from the template?
variations = identify_variations(problem, template)
# 4. Connect: which previous problems also use this pattern?
related = find_related_problems(pattern)
# 5. Predict: if the interviewer follows up, what variations are likely?
followups = predict_followups(problem)
return {
"pattern": pattern,
"template": template,
"variation_points": variations,
"related_problems": related,
"likely_followups": followups,
}
Mistake 2: Too many problems, too fast
# Symptoms:
# - Doing 5-10 problems per day, spending only 15 minutes each
# - Marking problems "done" without ever reviewing
# - Optimizing for "number of problems completed" instead of "patterns mastered"
# Mathematical proof of why this is inefficient:
# Assume per problem:
# - No review: 10% retention after 7 days
# - 3 spaced reviews: 80% retention after 30 days
#
# Strategy A: 10 problems/day, no review
# One month: 300 problems done, remember 300 * 10% = 30 problems
#
# Strategy B: 3 new problems/day + 2 review problems
# One month: 90 new + 60 reviews, remember 90 * 80% = 72 problems
#
# Strategy B's "effective yield" is 2.4x that of Strategy A
# Fix: quality over quantity
QUALITY_OVER_QUANTITY = {
"daily_new_problem_cap": 3,
"minimum_time_per_problem": "30 minutes (including analysis)",
"review_schedule": "Review at 1, 3, 7, and 14 days after first attempt",
"mastery_criterion": "Can write correct code in 20 minutes with zero hints",
}
Mistake 3: Skipping fundamentals
# Symptoms:
# - Jumping straight to Hard problems, skipping Easy/Medium
# - Solving problems without learning theory (memorizing transition equations
# without understanding the mathematical definition of DP)
# - Solving a problem without knowing WHY; any variation breaks you
# Analogy:
# This is like trying to learn calculus while skipping arithmetic and algebra.
# You might memorize certain integral formulas, but you cannot derive new ones.
# Fix:
FOUNDATION_FIRST = {
"correct_order": [
"1. Study fundamental data structures (this book, Ch. 1-10)",
"2. Solve Easy problems for each data structure (build intuition)",
"3. Study fundamental algorithms (this book, Ch. 11-20)",
"4. Solve Medium problems (apply patterns)",
"5. Study advanced topics (this book, Ch. 21-40)",
"6. Solve Hard problems (combine multiple patterns)",
],
"litmus_test": "If you cannot explain an algorithm's core idea to someone else "
"in under 5 minutes, you do not truly understand it. "
"Do not move forward yet.",
}
Mistake 4: Never doing mock interviews
# Symptoms:
# - Performing well on LeetCode but freezing in actual interviews
# - Not accustomed to thinking out loud while coding
# - Poor time management (spending too long on the first half)
# Fix:
MOCK_INTERVIEW_PROTOCOL = {
"frequency": "At least once per week",
"methods": [
"Find a friend for reciprocal mocks (most effective)",
"Use Pramp / Interviewing.io (second-best)",
"Time yourself + record audio for playback (minimum viable)",
],
"key_practice_areas": [
"Verbalize your thinking (do not go silent for more than 30 seconds)",
"Time management (must start coding within 15 minutes)",
"Active testing (manually trace through your code after writing)",
"Handling stuckness (ask for a hint instead of going silent)",
],
}
4.2 Sustained Learning Advice
Do not stop learning after receiving an offer:
POST_OFFER_LEARNING = {
"before_starting": {
"system_design": "Read DDIA (Designing Data-Intensive Applications)",
"language_depth": "Read the language spec / source (e.g., CPython internals)",
"team_prep": "Familiarize yourself with your new company's tech stack",
},
"months_0_to_3": {
"focus": "Understand the codebase architecture, learn internal tools",
"algorithm_maintenance": "1-2 problems per week to prevent decay",
},
"months_3_to_12": {
"focus": "Go deep in one direction (e.g., distributed systems, ML systems)",
"breadth": "Read papers, attend tech talks",
},
"long_term": {
"focus": "T-shaped growth โ deep in one area + broad awareness",
"goal": "Can design systems, lead teams, make technical decisions",
},
}
4.3 Learning Mindset
Growth Mindset:
Dweck (2006, Mindset: The New Psychology of Success) demonstrated that people who believe intelligence grows through effort outperform those who believe intelligence is fixed, especially on difficult tasks.
MINDSET_PRINCIPLES = {
"accept_difficulty": "Not solving a Hard problem is normal โ it does not mean you are incapable",
"embrace_errors": "Every bug is a learning opportunity, not a failure",
"process_oriented": "Focus on 'what did I improve today' not 'what is my rank'",
"long_term_thinking": "Algorithm ability builds over 3-6 months, not 3 days",
"compare_with_yourself": "Benchmark against yourself a month ago, not against LeetCode legends",
}
Dealing with Plateaus:
PLATEAU_STRATEGIES = {
"symptom": "Two weeks of practice with no perceived improvement",
"causes": [
"Difficulty is not increasing (staying at the same level)",
"Lack of feedback (not analyzing mistakes after solving)",
"Fatigue (grinding more than 3 hours per day)",
],
"solutions": [
"Switch to a different problem type (break single-pattern fatigue)",
"Increase difficulty (jump from Medium to Hard)",
"Decrease quantity but increase depth (write detailed analyses)",
"Take 2-3 days off (your brain needs consolidation time)",
"Change modality (watch videos, read papers, teach someone else)",
],
}
4.4 From Solo Practice to Team Growth
If you have reached an advanced level, consider helping others โ this is the most effective way to solidify your own knowledge (the Feynman Technique):
TEACHING_AND_GROWING = {
"organize_study_groups": {
"format": "Weekly meeting, 2-3 people, each person explains one problem",
"effect": "Explaining one problem clearly > solving ten problems",
},
"write_technical_blogs": {
"content": "Not solution write-ups (the internet has plenty), but 'how I arrived at this approach'",
"effect": "Forces you to organize your thinking, reveals blind spots in understanding",
},
"be_a_mock_interviewer": {
"format": "Give problems to friends, guide them, score them",
"effect": "Think from the interviewer's perspective โ understand what makes a 'good answer'",
},
"contribute_to_open_source": {
"format": "Fix bugs, write optimizations for open-source projects",
"effect": "Transforms algorithmic ability into engineering ability",
},
}
4.5 Knowledge Map of This Book
A review of the full 43-chapter knowledge structure:
Part I: Fundamental Data Structures (Ch. 1-10)
+-- Complexity Analysis (Ch. 1) โ The ruler for everything
+-- Arrays and Strings (Ch. 2) โ The most basic containers
+-- Binary Search (Ch. 3) โ Exploiting sorted order
+-- Linked Lists (Ch. 4) โ Dynamic structures
+-- Stacks and Queues (Ch. 5) โ Restricted-access containers
+-- Skip Lists (Ch. 6) โ Probabilistic ordered structures
+-- Union-Find (Ch. 7) โ Set merging and querying
+-- Hash Tables (Ch. 8) โ The cost of O(1)
+-- Bloom Filters (Ch. 9) โ Probabilistic set membership
+-- Trie (Ch. 10) โ The power of prefixes
Part II: Sorting and Searching (Ch. 11-18)
+-- Sorting Algorithms (Ch. 11-14)
+-- Selection Algorithms (Ch. 15)
+-- External Sorting (Ch. 16)
+-- Search Algorithms (Ch. 17-18)
Part III: Trees and Graphs (Ch. 19-24)
+-- Binary Trees (Ch. 19)
+-- BST and Balanced Trees (Ch. 20-21)
+-- Graph Traversal (Ch. 22)
+-- Shortest Paths (Ch. 23)
+-- MST and Advanced Graph Algorithms (Ch. 24)
Part IV: Algorithm Design Paradigms (Ch. 25-32)
+-- Greedy (Ch. 25)
+-- Backtracking (Ch. 26)
+-- Dynamic Programming (Ch. 27-30)
+-- Bit Manipulation (Ch. 31)
+-- Mathematical Algorithms (Ch. 32)
Part V: Advanced Topics (Ch. 33-40)
+-- Segment Trees / BITs (Ch. 33)
+-- String Algorithms (Ch. 34)
+-- Computational Geometry (Ch. 35)
+-- Randomized Algorithms (Ch. 36)
+-- Approximation Algorithms (Ch. 37)
+-- Parallel Algorithms (Ch. 38)
+-- Limits of Algorithms (Ch. 39) โ P vs NP
+-- Capstone Projects (Ch. 40)
Part VI: Summary and Application (Ch. 41-43)
+-- Interview Mastery (Ch. 41) โ Pattern taxonomy and solving frameworks
+-- From Algorithms to System Design (Ch. 42) โ Bridging two worlds
+-- Learning Path and Practice Guide (Ch. 43) โ You are here
Chapter Summary
| Key Point | Explanation |
|---|---|
| Four-stage roadmap | Beginner (50) -> Intermediate (150) -> Advanced (250+) -> Competitive |
| 200-problem curated list | Organized by pattern, annotated with frequency and key techniques |
| Spaced repetition | 1-3-7-14-30 day review intervals to combat the forgetting curve |
| Quality over quantity | 3 deep problems/day > 10 rushed problems/day |
| Deliberate practice | Clear goals, appropriate difficulty, immediate feedback, focused repetition |
| Production code bridge | Naming, type annotations, error handling, testability |
| Avoid pitfalls | Do not grind without thinking, do not rush, do not skip fundamentals |
| Sustained growth | The interview is just the starting line; real learning begins after employment |
End of Book. If you have read from Chapter 1 all the way here, congratulations โ you have built a complete knowledge chain from fundamental data structures to system design. Now begin practicing: choose problems appropriate for your current stage, follow the methodology in this chapter, and take one small step forward every day. Algorithmic ability is not talent โ it is accumulation. Good luck in your interviews, and excellence in your engineering.