Skip to content

Practice method: solve, review, repeat

~7 min

In short

  • Each problem gets a time box, then a review. The review is where most of the learning happens.
  • Read a hint only after the time box ends, and read a full solution only after a real attempt.
  • Log every mistake, then return to the mistakes on a schedule.

The rules below are the author's guidance, not a published method from any company.

The loop

  1. Read the problem and restate it in one or two sentences, with the input, output and constraints.
  2. Time box: 25 to 45 minutes. Use 25 minutes for easy problems and up to 45 for medium ones. Write the approach in comments before the code.
  3. If you are stuck at the end of the box, read one hint, not the whole solution. Try again for 10 minutes.
  4. If you are still stuck, read the solution. Then close it and write your own version from scratch.
  5. Test it. Run the examples, then edge cases: empty input, one element, duplicates, the largest input size.
  6. Review. State the time and space complexity. Write one line in the mistakes log: what went wrong, and what pattern you should have spotted.
  7. Come back to it using the schedule below.

How to read a solution

  • Read the idea first: what the key observation is, and why it works.
  • Then read the code slowly and trace it on a small input on paper.
  • Do not copy it into your solution folder. Close the page and rewrite it from memory. If you cannot, you have not learned it yet.
  • Note the pattern name in your log so you can find similar problems later.

Mistakes log

Keep one table, for example in a notes app or spreadsheet. Use the template in trackers. Record:

  • the problem name and link
  • what you got wrong: a wrong idea, an off-by-one error, a missed edge case, a slow approach
  • the fix, in one line
  • the date you will next review it

Mistakes repeat when they are not written down. Reviewing the log once a week is enough for most people.

Spaced repetition

Revisit each problem you solved with help, or got wrong, on this schedule:

Review When after first solve
1 Next day
2 3 days later
3 1 week later
4 3 weeks later

If you fail a review, restart the schedule for that problem. Repeat the problem from scratch, not from your old notes.

Writing code without an IDE

Interviews usually use a shared editor or a plain text box. Practise that:

  • Turn off autocomplete and code completion for practice sessions.
  • Write in plain text or a simple online editor. Do not run code until the examples are traced by hand.
  • Name variables clearly. Write small helper functions rather than one long block.
  • Expect to make syntax mistakes. Fix them calmly.

Talking aloud

Explain your thinking while you solve, even when practising alone. Say the brute-force idea first, then the improvement, then the complexity. Recording a practice session and listening back to it is a useful check.

When to move on

You can move to the next topic when, in the last two or three weeks on the current topic:

  • you solve most medium problems in the topic within the time box, without a hint, and
  • you can explain the approach and complexity out loud, and
  • the mistakes log has few new entries for this topic.

If you are not there yet, do not move on because the calendar says so. Stay on the topic and add problems.

Try this

Set a 30-minute timer, solve one medium problem, and write one line in the mistakes log, even if you solved it. Note whether you needed a hint, and when.

Sources

  • Tech Interview Handbook, coding interview study plan (weeks 1-4 study, weeks 5-12 practice): https://www.techinterviewhandbook.org/coding-interview-study-plan/
  • Tech Interview Handbook home page: https://www.techinterviewhandbook.org/