DSA Tracker

Blog

Interview Guide

Mock Interview Practice for DSA

Stop solving problems in silence. To master DSA interviews, you must explain your logic out loud while coding, forcing your brain to bridge the gap.

Riya Kushwaha, DSA Tracker team3 min read
On this page

You fail interviews because you think in code but explain in confusion. To fix this, stop solving problems in silence and start narrating your thought process out loud while you write. Treat every practice session like a live performance where the goal is not just the correct output, but a clear, logical path that an interviewer can follow without asking for clarification.

The mechanics of talking while coding

When you practice alone, use your phone to record your voice. Pick a medium-level problem like Merge Intervals. If your input is [[1,3],[2,6],[8,10],[15,18]], do not just start typing sort(). State your intent first. Say, "I will sort the intervals by start time to ensure that overlapping intervals are adjacent." This forces you to justify your O(n log n) complexity before you commit to the syntax. If you stumble while explaining, you do not understand the logic as well as you think. Stop, reset, and explain it again until the words flow as easily as the code.

Running a mock with a friend

If you practice with a friend, rotate roles strictly. The interviewer must not help. If the candidate gets stuck on a Binary Search implementation, the interviewer should only ask, "What is your condition for the mid pointer?" instead of pointing to the low or high variables. Set a timer for 35 minutes. If the candidate has not reached a working solution by minute 25, the interviewer must stop them and ask for a high-level summary of the remaining steps. This prevents the candidate from wasting time on syntax errors while the core logic remains unverified.

The feedback checklist

After the session, use this checklist to grade the performance. Did the candidate define the edge cases before writing code? Did they explain the time and space complexity before starting the implementation? Did they dry run the code with a small input? Did they maintain a steady pace without long periods of silence? If the answer to any of these is no, that is the specific area to target in the next session.

A worked example for your dry run

Take the problem of finding the First Missing Positive integer in an array like [3, 4, -1, 1]. A good candidate explains the cycle sort approach first. They say, "I will place each number x at index x-1 if x is within the range 1 to n."

  1. Start with [3, 4, -1, 1].
  2. Swap 3 to index 2: [-1, 4, 3, 1].
  3. Swap 4 to index 3: [-1, 1, 3, 4].
  4. Swap 1 to index 0: [1, -1, 3, 4].
  5. Scan the array: index 0 has 1, index 1 has -1.
  6. The first index where arr[i] != i + 1 is index 1, so the answer is 2.

If you cannot explain these steps while moving the numbers, you are relying on muscle memory rather than understanding.

Rules for your next session

  • Speak every line of logic before you type it.
  • Define the O(n) or O(log n) complexity before writing the first loop.
  • Use a timer and stop at 35 minutes regardless of progress.
  • Record your voice and listen to it to identify filler words or hesitation.
  • Never explain the code after writing it; explain it while you write it.

Use DSA Tracker to pick a random problem from a specific topic, set a timer on your phone, and record your explanation for the first 10 minutes of your next practice session.

Keep going with practice problems and the online compiler.

Further reading: Binary search on Wikipedia.

Share

XLinkedInWhatsApp

Frequently asked questions

Should I practice with someone better than me or at my level?

Practice with someone at your level. You need to learn how to explain concepts clearly, and explaining to a peer forces you to be precise and avoid jargon.

How many problems should I solve in a mock session?

One problem is enough. The goal is not volume but the quality of your communication and the depth of your explanation during the 35-minute window.

What if I get stuck and cannot solve the problem?

If you are stuck for 10 minutes, look at the hint, not the solution. If you still cannot solve it, study the approach, close the tab, and try again tomorrow.

Practice what you just read

Keep reading