A solid DSA preparation plan covers topics in dependency order (complexity, arrays and strings, hashing, two pointers and sliding window, stacks and queues, linked lists, recursion, trees, heaps, graphs, dynamic programming), practises problems by pattern rather than at random, revises regularly, and ends with timed mock interviews. Twelve weeks at one to two hours a day is a realistic plan for someone who can already program.
Why prepare DSA systematically?
Coding interviews at many product companies follow predictable patterns. Candidates who solve hundreds of random problems often still freeze on new ones, because they memorised solutions instead of learning patterns. A structured plan builds each topic on the last, groups problems by technique, and includes revision so concepts stay fresh. It also builds the habit interviews actually test: explaining your approach and its complexity out loud.
What should you know before starting?
Comfortable programming in one language (see learning Python from scratch), including functions, loops, lists and dictionaries, and basic recursion. If you're not there yet, spend a few weeks on fundamentals first; DSA practice is far more productive on top of fluent coding.
What does the 12-week plan look like?
| Week | Topics | Patterns to master |
|---|---|---|
| 1 | Complexity, arrays, strings | Traversal, prefix sums |
| 2 | Hash maps and sets | Counting, lookup, grouping |
| 3 | Two pointers, sliding window | Pair sums, longest/shortest windows |
| 4 | Sorting, binary search | Search on answer, intervals |
| 5 | Stacks, queues, linked lists | Monotonic stack, fast/slow pointers |
| 6 | Recursion, backtracking | Subsets, permutations, combinations |
| 7 | Binary trees, BSTs | DFS/BFS traversal, path problems |
| 8 | Heaps, priority queues | Top-k, merge k sorted, scheduling |
| 9 | Graphs | BFS/DFS, topological sort, union-find, Dijkstra |
| 10 | Dynamic programming I | 1D DP, knapsack, coin change |
| 11 | Dynamic programming II, tries, greedy | String DP, grids, intervals |
| 12 | Mixed revision, mock interviews | Timed problems, explanations |
How many problems per week?
A suggested plan, about 15 new problems a week (≈180 over 12 weeks), adjusted to your pace.
How should you work on each problem?
- Read carefully and restate the problem; note inputs, outputs and constraints (constraints hint at the expected complexity).
- Work examples by hand, including edge cases.
- Start with brute force and state its complexity.
- Identify the pattern and optimise.
- Code cleanly, then test with your examples.
- If stuck for 30–40 minutes, read a hint, not the full solution; if you read a solution, re-solve it yourself the next day.
- Log it: pattern, key insight, mistakes, complexity.
How do you make learning stick?
- Spaced revision: re-solve problems after 1 day, 1 week and 1 month without looking.
- Pattern notes: one page per pattern with a template and three example problems.
- Explain out loud: talk through solutions as if to an interviewer.
- Weekly review: list the patterns that still feel shaky and target them.
What about mock interviews?
From week 8 onwards, do at least one timed mock interview a week with a friend or mentor: 45 minutes, one or two problems, thinking out loud. Afterwards, review communication as well as code: did you clarify the problem, state complexity, test edge cases and handle hints well? Interview skill is a separate skill from problem solving, and it improves quickly with practice.
What mistakes slow people down?
- Solving only easy problems because they feel good.
- Reading solutions too quickly instead of struggling productively.
- Never revisiting solved problems, then forgetting them.
- Ignoring complexity analysis.
- Skipping system design and project preparation for experienced roles.
- Burning out with unrealistic daily targets; consistency beats intensity.
Does DSA still matter with AI coding assistants?
Yes. AI tools can produce code quickly, but they also produce slow or subtly wrong code, and you need DSA understanding to notice. Interviews still test it because it reveals problem-solving ability and clarity of thought. In data and AI work, complexity matters too: an O(n²) step that's fine on a sample can stall on a full dataset. Use AI assistants to explain concepts or review your solution, not to solve practice problems for you.
How does DSA fit with the rest of interview preparation?
For most developer roles, DSA is one part of a broader preparation: projects you can explain, SQL (see SQL interview questions), language fundamentals (see Python interview questions) and, for AI roles, machine learning (see ML interview questions). Balance your weekly time accordingly as interviews approach.
What does a daily routine look like?
A sustainable 90-minute weekday session: 10 minutes reviewing yesterday's notes; 50 minutes on one or two new problems from the week's topic, following the problem routine above; 20 minutes re-solving one older problem from memory; 10 minutes logging patterns and mistakes. On weekends, spend a longer session on harder problems and a weekly review of which patterns still feel weak. If you work full time, a lighter weekday plan with a longer weekend session still works over a slightly longer timeline; what matters is not missing whole weeks.
How do you recognise patterns quickly?
| Clue in the problem | Likely pattern |
|---|---|
| "Contiguous subarray" or "substring" with a condition | Sliding window |
| Sorted input, pair or triplet with a target | Two pointers |
| "Have we seen this before?", counts, frequencies | Hash map or set |
| "Next greater" or "previous smaller" element | Monotonic stack |
| "Top k", "k-th largest", merging sorted lists | Heap |
| All combinations or arrangements | Backtracking |
| Grid, network, dependencies | Graph traversal |
| "Minimum", "maximum", "number of ways" with choices | Dynamic programming |
| Monotonic yes/no answer over a range | Binary search on the answer |
What should you do in the final week before interviews?
Stop learning new topics. Re-solve a mixed set of problems you've seen, one or two from each pattern, under time limits; review your pattern notes and mistake log; do two full mock interviews; prepare short, clear explanations of two projects; and sleep properly. On the day, take time to clarify each problem, talk through your approach before coding, and test with an example. Calm, structured communication often matters as much as the final code.
What if you're starting from zero programming?
Then extend the plan: spend six to eight weeks on programming fundamentals and small projects first, then begin week 1 above. Trying to learn a language and advanced DSA simultaneously usually leads to frustration. A structured programme that teaches programming first and DSA next, with mentors to unblock you, shortens this path considerably.
How do you stay motivated over twelve weeks?
Track progress visibly: a simple sheet listing patterns, problems solved and problems re-solved from memory. Celebrate pattern milestones, not problem counts. Study with a friend or group for accountability, and explain one problem to someone each week. When a topic feels impossible, step back to easier problems in the same pattern for a day; confidence rebuilds quickly. Most people who finish a plan like this are not the most talented; they are the ones who kept showing up for short sessions on ordinary days.
How can you learn DSA with structure and support?
Program Zero dedicates ten weeks of live classes to data structures and algorithms, with weekly assignments, doubt sessions and a quarterly test, before moving to databases, full-stack development and AI. See the DSA course page for every topic.