Skip to content
Tutorials Center
My learning

Topics

Lesson 223 of 225 ยท Practice and Review

Coding Interview Preparation Plan

An eight-week, pattern-by-pattern plan for algorithm interviews: what to study each week, how to practice, how to run mock interviews and track progress.

Most people who struggle in algorithm interviews do not lack talent. They lack a plan. They solve random problems for a month, forget most of them, and walk in unable to say which technique a new problem needs. A good plan fixes three things: what you study, in what order, and how you check that it stuck.

This lesson gives you an eight-week schedule built around patterns instead of individual problems. It leans on the rest of this tutorial: each week points to the lessons that teach the technique, and the Patterns Cheat Sheet is your reference when you practice. If you have less time, the plan compresses; if you have more, repeat the hardest weeks. Either way, the habits matter more than the exact dates.

Principles that make practice work

  1. Pattern first, problems second. Learn one technique, then solve four to six problems that use it. After a few, the signal ("sorted input, find a pair") becomes automatic.
  2. Think before you type. Spend the first five to ten minutes on examples, the brute force and the complexity you need. Typing early is the most common way to get stuck.
  3. Struggle for a fixed time, then read. Give a problem 25 to 30 minutes. If you are stuck, read a hint, then the solution, then close it and write the solution from memory.
  4. Review on a schedule. A problem you solved once and never saw again is almost lost. Revisit it after one day, one week and one month.
  5. Say it out loud. Interviews are conversations. Practice explaining your idea, your complexity and your tests while you code.
flowchart LR
    A["Learn a pattern"] --> B["Solve 4-6 problems"]
    B --> C["Review misses<br/>after 1 day"]
    C --> D["Mixed practice"]
    D --> E["Mock interview"]
    E --> F{"Weak spot?"}
    F -- yes --> A
    F -- no --> G["Next pattern"]

The study loop: learn, practice, review, mix, then test yourself under interview conditions.

The eight-week schedule

Plan on about 8 to 10 hours per week: five or six sessions of 90 minutes. The first column links the lessons to read; the last column is what you should be able to do at the end of the week.

Week Focus Read You can do this by Sunday
1 Foundations: Big O, arrays, hashing Big O, Arrays, Hashing patterns State the complexity of your own code; solve pair-sum and frequency-count problems
2 Two pointers, windows, prefix sums, strings Two Pointers, Sliding Window, Prefix Sums Recognize "subarray" and "substring" signals and pick the right tool
3 Linked lists, stacks, queues Linked List Techniques, Stack Applications, Monotonic Stack Reverse a list, find a cycle, match brackets, find next greater element
4 Recursion, backtracking, binary search Recursion Patterns, Backtracking, Binary Search on the Answer Generate subsets and permutations; search an answer range
5 Trees and heaps Tree Traversals, Tree Problems, Top-K Problems Write DFS and BFS on trees without notes; use a heap for top K
6 Graphs Graph BFS, Graph DFS, Topological Sort, Dijkstra, Union-Find Model a grid or dependency list as a graph and choose the right traversal
7 Dynamic programming and greedy DP Introduction, 1D DP, Grid DP, Greedy Problems Define a state, write the recurrence, then memoize or tabulate
8 Mixed review and mock interviews Interview Questions, Practice Sets Solve unseen medium problems in 30 to 40 minutes while talking

Treat the table as a default. If trees are your weakest area, borrow days from week 1 and give week 5 two passes. A schedule that fits your weaknesses beats one that fits a calendar.

Daily structure for a 90-minute session

A repeatable session removes the daily decision of "what do I do now?":

  • 10 minutes reviewing: one problem from last week, solved again from scratch.
  • 15 minutes reading or re-reading one lesson for the week's pattern.
  • 50 minutes solving: two new problems, a timer on each.
  • 15 minutes writing notes: the signal, the idea in one sentence, the complexity and the mistake you made.

Keep the notes short and written in your own words. A good note reads like "Window that never shrinks below its best size: when a longer valid window is all that matters." When you reread them before an interview, they are far more useful than the code.

Track what you solve

A small script is enough to schedule reviews. The next example computes the review dates for a problem using the one-day, one-week, one-month rule, and then sorts a small log so that the most overdue items come first. Dates are plain integers (day numbers) to keep it simple.

Python A tiny spaced-review scheduler

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

You do not need an app for this. A spreadsheet with four columns (problem, pattern, date solved, next review) does the same job. What matters is that reviews are scheduled rather than remembered.

How to run a mock interview

Mocks are the closest thing to the real exam, and most people avoid them because they are uncomfortable. Do them anyway, starting in week 4 and increasing to two a week in week 8.

Setup. Find a friend, a mentor or a practice partner. If nobody is available, record yourself solving a problem aloud with a timer. Use a plain editor or a shared document without autocomplete, because many interviews do the same.

Format (45 minutes).

  1. Minutes 0 to 5: restate the problem, ask clarifying questions, confirm input sizes and edge cases.
  2. Minutes 5 to 12: work through an example, state the brute force and its complexity, then propose the better idea.
  3. Minutes 12 to 35: code the solution, narrating what each part does.
  4. Minutes 35 to 45: test with your own examples, trace one by hand, state time and space complexity, and discuss improvements.

Debrief. Right after the session, write down three things: where you lost time, which pattern you missed and what you would do differently. Then add the problem to your review log.

Questions to ask before you write any code are part of the skill. This TryIt turns them into a checklist you can print for each practice problem.

Python Pre-coding checklist generator

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

What to do in the last week

  • Stop learning new topics. Cramming a rare structure in the final days rarely pays off. Review the patterns you already know.
  • Re-solve your own misses. Your review log is the best problem list you will ever have, because it is made of your mistakes.
  • Prepare your talking points. Be ready to explain the complexity of hash tables, heaps, sorting and BFS in one sentence each. The Interview Questions lesson is a good drill.
  • Practice in the same environment. If the interview is on a shared editor or whiteboard, practice that way at least twice.
  • Sleep. A rested brain finds the idea faster than three more hours of problems.

When you get stuck in the interview

A short script keeps you moving. Say it aloud: "Let me try a small example." Then "What is the brute force?" Then "Which part repeats work? Can a hash map, a sort, a heap or a pointer remove it?" Interviewers want to see structured thinking, and a clear brute force with correct reasoning is worth far more than silence. If you truly cannot find the optimal idea, code the brute force correctly and discuss how to improve it.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Why does the plan organize practice by pattern instead of by individual problem?

    Most problems are variations of a small set of patterns. Learning the signal and the technique transfers to problems you have never seen.
  2. 2. A sensible rule for a problem you cannot solve after 25 to 30 minutes is:

    Struggling is valuable for a limited time. After that, learn from the solution, but prove you understood it by rewriting it yourself.
  3. 3. What is the main purpose of reviewing solved problems after one day, one week and one month?

    Spaced reviews bring a problem back just as you are about to forget it, which makes the knowledge last.
  4. 4. What should you do in the first minutes of a real interview problem?

    Clarifying and working an example prevents solving the wrong problem and often reveals the pattern.

Summary

  • Study by pattern, solve four to six problems per pattern, and read the matching lessons in this tutorial.
  • Follow the eight-week plan or compress it: foundations, windows and pointers, lists and stacks, recursion, trees and heaps, graphs, dynamic programming, then mixed review.
  • Time-box each problem, learn from solutions, then rewrite them from memory.
  • Schedule reviews at one day, one week and one month, and keep short notes in your own words.
  • Run mock interviews with a clear 45-minute format and debrief every one.
  • In the last week, review instead of learning new topics, and rehearse talking through your reasoning.

Next, put the plan to work with the Practice Sets by Topic.