Phase 2 — DSA in C++ (Months 3–5, W9–W20)¶
“You already know the algorithms in Python. This phase is about paying the study partner in the currency they asked for: STL-fluent, bug-free C++, produced under a 25-minute clock.”
You are Raghul, an applied ML engineer at Zoho, three years out of college, returning to C++ after two years. You do not need to learn DFS again. You need to type a correct DFS in C++ with the right iterator, the right unordered_map idiom, and the right integer type — while narrating your approach — inside 25 minutes. That is a very different skill.
Mission¶
By the end of Phase 2, C++ stops being the language you write algorithms in and becomes the language you write algorithms with. When a Medium problem lands on the screen, your first thought is the pattern, not the syntax. Your fingers know unordered_map<string, vector<int>>::iterator without checking. priority_queue with a custom comparator is muscle memory. You do not fumble long long casts on multiplication.
This is the phase where dual-language readiness becomes real. Most ML engineers we track either (a) do all study prep in Python and get filtered out of C++ shops, or (b) attempt C++ prep and quit at week 3 because they never internalize STL. You do neither.
Why raw C++ for DSA when Python is easier — the honest thesis¶
Let us be blunt about tradeoffs, because the internet will not.
study signal is language-conditional. For pure algorithm rounds at Google, Meta, most Indian product companies (Zoho, Freshworks, PhonePe, Flipkart), and every HFT/quant/systems shop, Python is accepted. But at low-latency, systems, or infrastructure teams — the ones you actually want as an ML-systems engineer — showing up in Python signals “I can think, but I have not paid the tax.” C++ signals “I have paid the tax and I can operate at your level.”
Muscle memory is the point. In an study, cognitive budget is finite. If 30% of your budget goes to “what was the syntax for a min-heap again,” you have 70% left for the actual problem. The candidate next to you who has 100% for the problem beats you every time. This phase burns the syntax into your fingers.
STL fluency compounds. Every ML infra codebase (PyTorch, TensorFlow, ONNX Runtime, TVM, LLVM, Faiss) is STL-heavy. Reading
std::unordered_map<int64_t, std::vector<std::pair<int, float>>>::const_iteratorat a glance is a job skill, not a party trick.The honest downside. For pure algorithmic reasoning — the ability to invent the solution, not type it — Python is a better learning tool. It gets out of the way. That is why file 02 recommends solving each new pattern in Python first, then porting. This is not weakness. This is calibration.
Exit criteria (do not leave this phase until all are true)¶
You cannot proceed to Phase 3 until you can honestly check every box below. No self-deception. Screen-record yourself solving a random Medium and re-watch.
Solved all 150 NeetCode problems in raw C++, compiling clean under
-std=c++20 -Wall -Wextra -Wpedantic.Solve any random NeetCode Medium in ≤ 25 minutes, cold, no lookup.
Solve any random NeetCode Hard in ≤ 45 minutes with ≤ 15 min of targeted lookup allowed.
Type a min-heap with custom comparator without looking up syntax.
Type recursive + iterative DFS, BFS with parent tracking, Dijkstra, and Kahn’s topo sort from memory.
Implement Union-Find, Trie, Segment Tree (point update + range query), and Fenwick tree from scratch, tested.
Explain when to prefer
unordered_mapvsmap, and cite the DoS/collision issue on adversarial inputs.Explain when
long longmatters and cite three problems whereintoverflows silently.Recite the fast-I/O incantation and explain why each line matters.
Complete 10 timed mock studies (self-recorded), narrating out loud.
Public GitHub repo with all 150 solutions, CI-compiled (Project P2.1).
Public cheatsheet gist/blog with your templates (Project P2.2).
If any box is unchecked at W20, extend the phase. Do not enter Phase 3 half-cooked; the systems material is unforgiving.
W9–W20 breakdown¶
Twelve weeks. ~150 problems + custom DS + 10 mocks + 2 public artifacts. You will need every hour. Overlap is intentional — the last three weeks of Phase 2 run in parallel with the first three weeks of Phase 3’s reading, to smooth the transition.
Weeks |
Focus |
Deliverable |
|---|---|---|
W9 |
STL crash + fast I/O + Arrays & Hashing (10 problems) |
File 01 internalized |
W10 |
Two Pointers + Sliding Window (12 problems) |
Templates in file 05 |
W11 |
Stack + Binary Search (12 problems) |
First 3 mocks |
W12 |
Linked List + Trees (14 problems) |
— |
W13 |
Tries + Heap/PQ (12 problems) |
Trie + PQ template in file 04 |
W14 |
Backtracking + Graphs I (14 problems) |
Backtracking skeleton |
W15 |
Graphs II + Advanced Graphs (12 problems) |
Dijkstra, Bellman, Floyd |
W16 |
1D DP (12 problems) |
Memo→tab conversion drill |
W17 |
2D DP + Greedy (14 problems) |
Overlap with Phase 3 reading begins |
W18 |
Intervals + Math/Geometry + Bit Manip (14 problems) |
— |
W19 |
Custom DS deep-dive: Union-Find, Segment Tree, Fenwick |
File 03 finalized |
W20 |
Mock marathon (7 mocks), publish P2.1 + P2.2 |
Portfolio artifacts live |
What most people get wrong¶
They fight the language. They approach C++ as if it were an obstacle course between them and the algorithm. Every solution becomes a battle with iterators, size_t underflow, or unordered_map initialization. Six weeks in they quit and go back to Python, then blame C++.
The reframe: the language is not the obstacle. The unfamiliarity is. Everyone who is fluent in C++ went through this same tunnel. What separates the ones who came out from the ones who quit is that the former treated STL as a language to memorize, not a library to look up. Twenty templates, drilled until reflexive, cover ~95% of NeetCode 150. File 05 gives you those twenty templates. Type each one out ten times by hand this month. That is the drill.
The second thing most people get wrong: they solve for correctness, never for speed. studies are timed. If you can solve every problem in 90 minutes, you cannot solve any of them in an study. Set a timer. Every problem. Non-negotiable.
The 2026 reality check (from research this week)¶
NeetCode 150 remains the curated list. It is still updated (roadmap page live as of 2026). No serious replacement has emerged. Some people call it overhyped on Reddit; the empirical answer is that finishing it puts you above ~80% of candidates.
FAANG studies in 2026 are shifting: raw coding speed is a weaker signal than it used to be (post-Copilot). System design, debugging-from-logs, and reasoning-under-uncertainty are rising. But — and this matters — coding rounds have not gone away. They are the filter. You still cannot skip them.
For pure algorithmic depth beyond NeetCode 150, LeetCode’s own “Top study 150” and “SQL 50” lists remain the canonical follow-ups. Codeforces is optional and only worth it if you enjoy contests; it does not measurably improve study outcomes past a certain skill floor.