InterviewDryRun

How to prepare for a coding interview: a four-week DSA plan

Most coding interview preparation fails in one of two ways: endless problem-solving with no structure, or endless reading with no practice. This plan fixes both. Four weeks, about ninety minutes a day, organised around the patterns that interview problems are built from, with a mock interview every few days to check it is working.

Published

What a coding round actually tests

A coding interview is not a test of how many problems you have memorised. Interviewers score roughly the same five things wherever you go:

  • Problem solving. Can you get from a vague prompt to a working idea, starting with a brute force and improving it?
  • Data structures and algorithms. Do you reach for the right tool, a hash map, a heap, a graph search, and know its cost?
  • Code. Is it correct, readable, and written in a language you know well?
  • Testing. Do you check your own code against a normal case and an edge case before saying “done”?
  • Communication. Could the interviewer follow your thinking the whole time, without asking what you are doing?

Notice that three of the five are about how you work, not what you know. That is why the plan below spends as much time on practicing out loud as on learning patterns.

Before you start: pick one language

Use the language you write fastest, with the standard library you know best. Python, Java, C++ and JavaScript are all fine. Switching languages for interviews costs you weeks of fumbling with syntax that you should spend on problems. Learn the handful of library calls you will use constantly: sorting with a custom key, a hash map with default values, a heap, a double-ended queue, and string building.

The four-week plan

Each week covers a group of patterns. Aim for two or three problems a day, and do not move on from a problem until you could explain the solution to someone else.

Week 1: arrays, hashing and two pointers

Week 2: stacks, binary search, heaps and linked lists

Week 3: trees and graphs

  • Patterns: depth-first and breadth-first search, recursion on trees, grids as graphs, topological sort, union-find.
  • Problems to start with: Number of Islands and Course Schedule, then tree traversals, lowest common ancestor and shortest path in a grid.
  • End of week: two mock interviews. Graph problems are where nerves show most, so get the reps in.

Week 4: dynamic programming, design-style problems and full mocks

  • Patterns: one-dimensional and two-dimensional dynamic programming, memoised recursion first and tables second, and data-structure design problems.
  • Problems to start with: Coin Change, Word Break and LRU Cache.
  • End of week: a mock interview every other day, at the length and level of your real interview. Spend the days between redoing the problems you scored worst on.

How to work a single problem

The way you practice each problem matters more than the number you do. Use the same routine every time, because it is the routine you will fall back on in the interview:

  1. Restate the problem and ask about input size, duplicates, empty input and whether you can modify the input.
  2. Say a brute force and its time and space complexity, even if it is obviously slow.
  3. Find the bottleneck in the brute force and name the pattern that removes it.
  4. Write the code, talking as you go. Name variables properly.
  5. Test it by hand on one normal case and one edge case, then state the final complexity.

If you are stuck for more than twenty minutes, read the solution, close it, and write it yourself. Then come back to the same problem three days later. Spaced repeats are what make a pattern stick.

Why you need mock interviews, not just problems

Solving a problem silently at your desk and solving it out loud while someone watches the clock are different skills. Plenty of people who can solve medium problems alone freeze in the room because they have never had to explain a half-formed idea. A mock interview every few days shows you where that gap is while there is still time to close it.

A practice interview with an AI interviewer works well here because you can do one whenever you have forty-five minutes. InterviewDryRun runs coding rounds on video: Max asks the question, watches your code in the editor, asks why when you skip a step, and gives you a scored report with three fixes and a model answer. The guide to AI mock interviews explains how to get the most from each session.

Mistakes that waste preparation time

  • Counting problems instead of patterns. Three hundred problems solved once teaches less than a hundred solved, understood and repeated.
  • Only doing easy problems. Most interviews are pitched at medium. Spend most of your time there.
  • Never timing yourself. Without a clock you will not learn when to move from brute force to code.
  • Skipping the explanation. If you cannot say why the solution works, you will not find it again under pressure.
  • Leaving mocks to the last week. By then you can only find problems, not fix them.

Questions to practice next

Try it on a real interviewer

Free: a 5-minute voice round and unlimited typed drills, with scored feedback and a model answer. No card, and your camera is never recorded. How the free mock interview works.

Start a free interview