Finale · Paradigm atlas
You have practiced twelve chapters of algorithms. This last one teaches a single skill: reading a problem statement and deciding which approach to try first. There is nothing mysterious about it. Ask four questions in order — what is being asked, can a greedy choice be proved safe, do the subproblems repeat, and is there a monotonic test on the answer — and the approach follows.
Choosing a paradigm
Take any problem and walk through these questions. After enough repetitions you will ask them without the page.
Question 1: what is the problem actually asking for?
How to use the guide
It is not a lookup table of correct answers. It is an order of questions: first what the problem asks for, then whether a greedy choice can be proved safe, whether the subproblems repeat, and whether a candidate answer can be tested. Real problems often need a combination: backtracking with pruning, greedy with a heap, binary search wrapped around a DP check. Decide each part separately, then put them together. If you reach a dead end and notice the subproblems repeating, that is the signal for DP.
Every problem in the course: 147
The high-frequency problems from all twelve chapters. Your checkmarks are shared with each chapter page, so this is one single list.
A 20-week plan
🗓 5 study days, 1 review day, 1 rest dayThe recommended order as a table. The structures track (DataData) and the algorithms track (this course) alternate.
| Week | Main topic | Track | What you should be able to do |
|---|---|---|---|
| Week 0 | Recursion, Big-O, comparators, testing habits | Algorithms | Write the common templates without help and explain their complexity. |
| Week 1 | Array basics, fast and slow pointers, editing in place | Structures | Handle indexes, overwriting, deletion, and moving elements. |
| Week 2 | Hash tables, counting characters, prefix sums | Structures | Recognize lookup, counting, and range-sum problems. |
| Week 3 | Linked lists, the dummy head node, fast and slow pointers | Structures | Draw the pointers yourself, then insert, delete, and reverse. |
| Week 4 | Stacks, queues, brackets, expressions | Structures | Decide when the order should be LIFO and when it should be FIFO. |
| Week 5 | Two pointers and the sliding window | Structures | Write both the fixed-size and the variable-size window template. |
| Week 6 | Binary search and its boundaries, then binary search in depth | Algorithms | Write the closed-interval template, explain the state at exit, and practice guessing a monotonic answer. |
| Week 7 | Sorting, merging, quickselect, and divide and conquer | Algorithms | Compare comparison sorts, heaps, and quickselect, and estimate cost with a recursion tree. |
| Week 8 | Binary tree DFS and BFS, and the three parts of a recursive call | Structures | Write preorder, inorder, postorder, and level-order traversal. |
| Week 9 | Binary search trees, building a tree, lowest common ancestor | Structures | Use the ordering of a BST instead of visiting every node. |
| Week 10 | Heaps, Top-K, the monotonic stack | Structures | Recognize the signals for next greater or smaller element, and for Top-K. |
| Week 11 | Backtracking: combinations, subsets, permutations | Algorithms | Draw the search tree, and handle used and startIndex correctly. |
| Week 12 | Backtracking: partitioning, board problems, pruning and duplicates | Algorithms | Explain the difference between skipping duplicates across a level and along a branch. |
| Week 13 | Graph DFS and BFS, islands, fewest steps in an unweighted graph | Structures | Handle visited, connected components, and multi-source BFS. |
| Week 14 | Union-find, topological sort, a first shortest-path algorithm | Structures | Course Schedule, redundant connection, and Dijkstra on non-negative weights. |
| Week 15 | Greedy: intervals, jump game, stock problems | Algorithms | Explain why each local choice is safe, with an exchange argument. |
| Week 16 | DP basics, grid DP, House Robber | Algorithms | Write the state definition and the transition with the five-step method. |
| Week 17 | Knapsack, coin change, target sum | Algorithms | Tell 0/1 from unbounded knapsack, and get the loop order right. |
| Week 18 | LIS, LCS, stock DP, advanced DP, and tries | Algorithms | Cover the important advanced problems. Full coverage is not the goal. |
| Weeks 19–20 | Mixed timed sets, mock interviews, redoing what you got wrong | Algorithms | Finish a medium problem in 35 to 45 minutes while explaining every step out loud. |
Five optional chapters you can insert at any point
Where is the structures track?
The weeks marked Structures (arrays, hash tables, linked lists, stacks and queues, trees, heaps, graphs) belong to the companion course DataData · Data structures you can see. Two pointers, the sliding window, the monotonic stack, BFS and DFS, topological sort, and Dijkstra are taught there. The two courses were written to fit together into one 20-week route.
Mock interview guide
🎯 Interview standardHaving solved a problem is not the same as knowing it. Here are six things an interview expects, and a review schedule that keeps what you learned.
A problem counts as finished only when all six standards hold at the same time:
Review schedule: three points that work against forgetting
Solving a problem once is not the end of it. Come back on this schedule, and being able to solve it turns into being fluent at it.
DataData × AlgoAlgo
Data structures are the nouns, algorithms are the verbs. Together the two courses cover data structures and algorithms as a whole.
The nouns an algorithm works on. The shape you store data in decides how fast you can move it.
- Arrays / strings / linked lists
- Stacks / queues / monotonic stack / monotonic deque
- Hash tables / binary trees / binary search trees
- Heaps / tries / union-find / graphs
- Two pointers · sliding window · BFS · DFS · topological sort · Dijkstra
The verbs applied to those structures. Each one turns a problem into a sequence of decisions and states.
- Sorting / divide and conquer / binary search in depth / bit manipulation
- Backtracking (a decision tree) / greedy (an exchange argument)
- Four DP chapters: basics → knapsack → subsequences → advanced
- Math and number theory / string algorithms (KMP)
- Choosing a paradigm: from the problem statement to an approach
Why the material is split into two courses
Both courses share one shell and one design language, but the split is deliberate. A structure decides how fast you can read and write the data. An algorithm decides how a problem is turned into a sequence of decisions. Learn the nouns first, then practice the verbs. Put them together and you have a complete route from the beginning to an interview.
Final quiz: 8 questions on choosing a paradigm
✎ Whole-course quizNo template recall. Every question gives you a problem statement and asks which approach you would reach for, which is what an interview actually does.
Coins [1, 3, 4], target 6. Greedy takes the largest coin every time: 4 + 1 + 1, three coins. The best answer is 3 + 3, two coins. What does this show?
You have to find a target value in a sorted array that has been rotated, in O(log n) time. Which paradigm?
The problem asks you to output every permutation of an array. First choice?
Compute x to the power n, where n can be as large as 10⁹. Which one?
What is the clearest signal that a problem needs DP?
"Halve the largest value in the array, repeat k times, then minimize the array sum." For a problem where each step takes the locally best option and you can prove you will not regret it, what is the first choice?
Find the length of the longest common subsequence of two strings. Which one?
Which of these statements about greedy and DP are correct? (Select all that apply.)
- Ask the four questions in order: what is being asked → can a greedy choice be proved safe → do the subproblems repeat → is there a monotonic test on the answer. By the end of them the paradigm has usually chosen itself.
- One line runs through the four DP chapters: backtracking is too slow and greedy cannot be proved, so DP is the fallback. Coin Change (LC 322) with coins [1, 3, 4] is the counterexample that makes "greedy can fail" concrete.
- Hard problems combine paradigms: backtracking with pruning, greedy with a heap, binary search around a feasibility check, divide and conquer upgraded to DP. Decide each part separately, then combine. The same problem often has more than one valid view (53, 122, 322).
- No paradigm is fastest everywhere. When greedy applies it uses the least time and memory; DP is the general fallback, not the faster choice. Being able to explain why you did not use X counts for more than being able to use X.
- "Finished" means all six interview standards hold, plus D+1 explaining it out loud, D+7 redoing it, and D+21 redoing it against a timer. Work through the full problem list three times and fill in every chapter. Then go and take the real test. 🎓