AlgoAlgo/Finale · Paradigm Atlas
CHAPTER · Paradigm Atlas

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.

§01

Choosing a paradigm

Take any problem and walk through these questions. After enough repetitions you will ask them without the page.

Choosing a paradigm: the questions to ask, in order

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.

§02

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.

0 / 147
0% done
A suggested rhythm: on the first pass through a chapter, do the easy problems to get used to the pattern.
On the second pass, only the medium ones. On the third pass, work against a timer.
01SortingReview →9 problems
02Divide and ConquerReview →7 problems
03Binary Search in DepthReview →18 problems
04Bit ManipulationReview →11 problems
05BacktrackingReview →15 problems
06GreedyReview →18 problems
07Dynamic ProgrammingReview →13 problems
08Knapsack ProblemsReview →10 problems
09Subsequence DPReview →12 problems
10Advanced DPReview →12 problems
11Math & Number TheoryReview →13 problems
12String AlgorithmsReview →9 problems
§03

A 20-week plan

🗓 5 study days, 1 review day, 1 rest day

The recommended order as a table. The structures track (DataData) and the algorithms track (this course) alternate.

WeekMain topicTrackWhat you should be able to do
Week 0Recursion, Big-O, comparators, testing habitsAlgorithmsWrite the common templates without help and explain their complexity.
Week 1Array basics, fast and slow pointers, editing in placeStructuresHandle indexes, overwriting, deletion, and moving elements.
Week 2Hash tables, counting characters, prefix sumsStructuresRecognize lookup, counting, and range-sum problems.
Week 3Linked lists, the dummy head node, fast and slow pointersStructuresDraw the pointers yourself, then insert, delete, and reverse.
Week 4Stacks, queues, brackets, expressionsStructuresDecide when the order should be LIFO and when it should be FIFO.
Week 5Two pointers and the sliding windowStructuresWrite both the fixed-size and the variable-size window template.
Week 6Binary search and its boundaries, then binary search in depthAlgorithmsWrite the closed-interval template, explain the state at exit, and practice guessing a monotonic answer.
Week 7Sorting, merging, quickselect, and divide and conquerAlgorithmsCompare comparison sorts, heaps, and quickselect, and estimate cost with a recursion tree.
Week 8Binary tree DFS and BFS, and the three parts of a recursive callStructuresWrite preorder, inorder, postorder, and level-order traversal.
Week 9Binary search trees, building a tree, lowest common ancestorStructuresUse the ordering of a BST instead of visiting every node.
Week 10Heaps, Top-K, the monotonic stackStructuresRecognize the signals for next greater or smaller element, and for Top-K.
Week 11Backtracking: combinations, subsets, permutationsAlgorithmsDraw the search tree, and handle used and startIndex correctly.
Week 12Backtracking: partitioning, board problems, pruning and duplicatesAlgorithmsExplain the difference between skipping duplicates across a level and along a branch.
Week 13Graph DFS and BFS, islands, fewest steps in an unweighted graphStructuresHandle visited, connected components, and multi-source BFS.
Week 14Union-find, topological sort, a first shortest-path algorithmStructuresCourse Schedule, redundant connection, and Dijkstra on non-negative weights.
Week 15Greedy: intervals, jump game, stock problemsAlgorithmsExplain why each local choice is safe, with an exchange argument.
Week 16DP basics, grid DP, House RobberAlgorithmsWrite the state definition and the transition with the five-step method.
Week 17Knapsack, coin change, target sumAlgorithmsTell 0/1 from unbounded knapsack, and get the loop order right.
Week 18LIS, LCS, stock DP, advanced DP, and triesAlgorithmsCover the important advanced problems. Full coverage is not the goal.
Weeks 19–20Mixed timed sets, mock interviews, redoing what you got wrongAlgorithmsFinish a medium problem in 35 to 45 minutes while explaining every step out loud.

Five optional chapters you can insert at any point

02 Divide and ConquerTake it together with sorting in week 7: fast exponentiation, merging, and an intuition for the master theorem.
04 Bit ManipulationA light tool chapter. Fit it into weeks 6 and 7; it prepares you for bitmask DP in chapter 10.
10 Advanced DPRight after week 18: state machines, interval DP, tree DP, and bitmask DP.
11 Math & Number TheoryInsert it wherever you find a gap: modular arithmetic, the prime sieve, majority vote, and game theory.
12 String AlgorithmsFinish with it after week 18: KMP, rolling hash, and palindromes.

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.

§04

Mock interview guide

🎯 Interview standard

Having 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:

Standard 01When you read a problem, describe the brute-force solution first, then improve it step by step. Do not stay silent until the optimal answer arrives.
Standard 02Explain why you chose this data structure or paradigm, and why you did not choose the obvious alternative.
Standard 03State the time and space complexity, and explain where those numbers come from.
Standard 04Cover five kinds of edge case without being asked: empty input, one element, duplicate values, index out of range, and overflow.
Standard 05Write code that runs, on a whiteboard or in a plain text editor, with no autocomplete.
Standard 06Within the time limit, go through all four steps: clarify the question, design, code, test. Getting Accepted is not the goal.

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.

D+1
The next day
Say the approach out loud and write the core code by hand. If you cannot explain it, you do not know it yet.
D+7
One week later
Redo the whole problem without your notes, to check what actually stayed.
D+21
Three weeks later
Redo it under a time limit, so that solving it becomes routine rather than possible.
Pre-interview
Final stretch
Pick problems at random by pattern, not in chapter order. An interview will not tell you which chapter the problem comes from.
§05

DataData × AlgoAlgo

Data structures are the nouns, algorithms are the verbs. Together the two courses cover data structures and algorithms as a whole.

Structures
DataData · Data structures you can see

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
Algorithms
AlgoAlgo · Algorithms you can see

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.

§06

Final quiz: 8 questions on choosing a paradigm

✎ Whole-course quiz

No template recall. Every question gives you a problem statement and asks which approach you would reach for, which is what an interview actually does.

QUESTION 01 / 8

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?

QUESTION 02 / 8

You have to find a target value in a sorted array that has been rotated, in O(log n) time. Which paradigm?

QUESTION 03 / 8

The problem asks you to output every permutation of an array. First choice?

QUESTION 04 / 8

Compute x to the power n, where n can be as large as 10⁹. Which one?

QUESTION 05 / 8

What is the clearest signal that a problem needs DP?

QUESTION 06 / 8

"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?

QUESTION 07 / 8

Find the length of the longest common subsequence of two strings. Which one?

QUESTION 08 / 8

Which of these statements about greedy and DP are correct? (Select all that apply.)

The last summary card
  • 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. 🎓