/ DSA with C++ / Phase 21 Phase 21 Days 118-122
Number Theory & Combinatorics The math toolkit for CP: sieve, modular arithmetic, inverses, combinatorics, matrix exponentiation
Phase Goal Acquire the arithmetic that gates a huge fraction of Codeforces problems above 1400.
Day 118: Primes & factorization
Practice, delayed recall, and independent transfer Choose one core problem from LeetCode, Codeforces, AtCoder, or CSES after checking its prerequisites; hide its technique label Spend 10–20 minutes retrieving one earlier mechanism and one earlier bug before new work; prioritize weak prerequisites Use a five-task bank: guided warm-up, core, changed constraint, delayed recall, optional stretch; attempt one or two, not all five on a timer Before a solution, produce a trace or brute-force plan; when stuck take one hint, act on it, then reassess Record help used, the failing input, the corrected reasoning, and a next review date; start around 1/3/7/14/30 days and adapt Reserve a weekly mixed review; after foundation readiness add a short virtual contest and upsolve one task with known prerequisites Prove progress through a delayed blank-editor reconstruction and a changed problem; a same-day quiz is supporting evidence only
Day 119: Modular arithmetic
Practice, delayed recall, and independent transfer Choose one core problem from LeetCode, Codeforces, AtCoder, or CSES after checking its prerequisites; hide its technique label Spend 10–20 minutes retrieving one earlier mechanism and one earlier bug before new work; prioritize weak prerequisites Use a five-task bank: guided warm-up, core, changed constraint, delayed recall, optional stretch; attempt one or two, not all five on a timer Before a solution, produce a trace or brute-force plan; when stuck take one hint, act on it, then reassess Record help used, the failing input, the corrected reasoning, and a next review date; start around 1/3/7/14/30 days and adapt Reserve a weekly mixed review; after foundation readiness add a short virtual contest and upsolve one task with known prerequisites Prove progress through a delayed blank-editor reconstruction and a changed problem; a same-day quiz is supporting evidence only
Day 120: Combinatorics
Practice, delayed recall, and independent transfer Choose one core problem from LeetCode, Codeforces, AtCoder, or CSES after checking its prerequisites; hide its technique label Spend 10–20 minutes retrieving one earlier mechanism and one earlier bug before new work; prioritize weak prerequisites Use a five-task bank: guided warm-up, core, changed constraint, delayed recall, optional stretch; attempt one or two, not all five on a timer Before a solution, produce a trace or brute-force plan; when stuck take one hint, act on it, then reassess Record help used, the failing input, the corrected reasoning, and a next review date; start around 1/3/7/14/30 days and adapt Reserve a weekly mixed review; after foundation readiness add a short virtual contest and upsolve one task with known prerequisites Prove progress through a delayed blank-editor reconstruction and a changed problem; a same-day quiz is supporting evidence only
Day 121: Matrix exponentiation & sequences
Probability & expectation (intro)
Practice, delayed recall, and independent transfer Choose one core problem from LeetCode, Codeforces, AtCoder, or CSES after checking its prerequisites; hide its technique label Spend 10–20 minutes retrieving one earlier mechanism and one earlier bug before new work; prioritize weak prerequisites Use a five-task bank: guided warm-up, core, changed constraint, delayed recall, optional stretch; attempt one or two, not all five on a timer Before a solution, produce a trace or brute-force plan; when stuck take one hint, act on it, then reassess Record help used, the failing input, the corrected reasoning, and a next review date; start around 1/3/7/14/30 days and adapt Reserve a weekly mixed review; after foundation readiness add a short virtual contest and upsolve one task with known prerequisites Prove progress through a delayed blank-editor reconstruction and a changed problem; a same-day quiz is supporting evidence only
Day 122: Number theory problem set & recap
Practice, delayed recall, and independent transfer Choose one core problem from LeetCode, Codeforces, AtCoder, or CSES after checking its prerequisites; hide its technique label Spend 10–20 minutes retrieving one earlier mechanism and one earlier bug before new work; prioritize weak prerequisites Use a five-task bank: guided warm-up, core, changed constraint, delayed recall, optional stretch; attempt one or two, not all five on a timer Before a solution, produce a trace or brute-force plan; when stuck take one hint, act on it, then reassess Record help used, the failing input, the corrected reasoning, and a next review date; start around 1/3/7/14/30 days and adapt Reserve a weekly mixed review; after foundation readiness add a short virtual contest and upsolve one task with known prerequisites Prove progress through a delayed blank-editor reconstruction and a changed problem; a same-day quiz is supporting evidence only
After this phase, you'll be able to:
Primes & factorization Modular arithmetic Combinatorics Matrix exponentiation & sequences Number theory problem set & recap After Phase 21, explain a core invariant, reconstruct a solution after a delay, diagnose a bug, and solve one unlabelled variation. Repair a failed prerequisite before advancing; record help separately from independent work.