Guide · coding-prep
How to Explain a LeetCode Solution Out Loud in an Interview
Narrate in four passes: restate the problem, walk through a brute force, propose the optimization with its complexity, then code while talking. The narration, not the code, is what gets you the offer. Explaining your coding solution out loud is the skill the interviewer is actually grading.
By Sam K., Founder, InterviewChamp.AI · Last updated
TL;DR: Narrate every coding problem in four passes: restate the problem, walk through a brute force, propose the optimization with its complexity, then code while talking. The interviewer is grading your reasoning, not your typing speed, and a clean solution explained badly fails more often than a brute force explained well. Practice by screen-recording yourself on a timed medium problem and counting the silent stretches.
How do you explain a LeetCode solution out loud in an interview?#
You run the same four passes on every problem. First you restate it and ask a few clarifying questions. Then you describe the brute force and its cost, propose the faster approach with its time and space complexity, and only then write code while you talk through it. Explaining a coding solution out loud is a learnable script, and the rest of this guide is that script, pass by pass.
Why does it matter so much? For a CS new grad in the 2026 hiring cycle, sending hundreds of applications for a handful of onsite slots, this is the skill that converts a slot into an offer. The people who get the offer are rarely the fastest typists. They're the ones who can say the answer in their own voice while their hands work. I'd put narration above raw problem-solving speed nine times out of ten, and the rubrics back me up.
Why narration beats correct code#
A coding interview is a signal-gathering exercise. Your interviewer can't read your mind, so the only reasoning they can grade is the reasoning you say out loud. Signal density, how much useful evidence of your thinking you produce per minute, is what moves a rubric, and silent correct code produces almost none of it.
Here is the contrast that decides most rounds:
| Moment in the problem | Weak (silent) version | Strong (narrated) version | |---|---|---| | First 60 seconds | Start typing immediately | Restate the problem, ask about input size and duplicates | | Choosing an approach | Quietly write the optimal solution | "Brute force is O(n²); a hash map gets me to O(n), here's the tradeoff" | | Mid-solution stall | Long silence, eyes on the screen | "I'm going to think for thirty seconds, is that okay?" | | Hitting a bug | Backspace and retype quietly | "Let me trace a small example. Ah, off-by-one on the boundary" | | Finishing | "Done." | "Time O(n), space O(n), handled empty input and duplicates. Anything to refactor?" |
The right-hand column isn't smarter. It's just audible. When two candidates reach the same answer, that is honestly the whole gap between a hire and a no-hire.
The same logic drives the broader habit in the guide on how to think aloud during a coding interview. This page is the structured walkthrough script; that one covers the minute-to-minute talking habit underneath it.
The four-pass method at a glance#
Use the same four passes on every problem, from a warmup two-pointer question to a hard graph problem. Having a fixed structure is what keeps you from freezing when the problem looks scary.
| Pass | What you say | Rough time | |---|---|---| | 1. Restate | Paraphrase the problem, ask clarifying questions, state your assumptions | About 60 seconds | | 2. Brute force | The naive approach, its complexity, a trace on a tiny example | About 2 minutes | | 3. Optimize | The data structure or observation that removes the bottleneck, plus time and space cost | About 2 minutes | | 4. Code and trace | Narrate each non-trivial line, then run your small example through the finished code | 5-10 minutes |
Each pass gets its own section below with the exact phrases to use.
Facing a problem you've never seen before? Run this same structure, just slower. The guide on how to handle a coding problem you have never seen shows how to shrink an unfamiliar problem until Pass 1 becomes possible.
Pass 1: Restate the problem (60 seconds)#
Read the problem out loud, then paraphrase it back in your own words. That catches misreads early and shows the interviewer you're not just pattern-matching to a memorized solution. Then ask:
- "Can the input be empty?"
- "Are values unique, or can there be duplicates?"
- "Is the input sorted?"
- "What's the expected input size, should I optimize for time, space, or both?"
Sometimes the interviewer just shrugs. In that case pick reasonable defaults and state them. "I'll assume non-empty input with up to 10⁴ elements" is engineering judgment. Coding silently is not.
The deeper version of this move, including how to tell a useful question from a stalling one, lives in the guide on handling clarifying questions on a coding problem.
Pass 2: Walk through a brute force (2 minutes)#
A brute force is the most obvious correct solution, written without any optimization, usually the nested-loop version. Always have one ready to discuss, even if you never code it. The format:
"The naive approach is to do X for every Y. That's O(n²) time and O(1) space. I think we can do better, but let me make sure that's correct first."
Next, trace it through a tiny example of 3-5 elements on the whiteboard or in the shared editor. You'll catch off-by-one bugs, confirm you understood the problem, and give the interviewer a chance to redirect you if you're solving the wrong thing.
Skipping this step is one of the most common reasons strong candidates get marked down. For more on how loops get debriefed, see Levels.fyi's interview analysis.
Pass 3: Propose the optimization with complexity (2 minutes)#
This is where the offer is won or lost. Time complexity is how the runtime grows as the input grows, written in Big-O notation, the upper-bound shorthand like O(n) or O(n log n) that interviewers expect on every solution. The pattern:
"We can avoid the nested loop by [data structure / observation]. That trades O(n) extra space for O(n) time. The intuition is [one-sentence why]."
Then say the complexity out loud before you write a single line:
- "Time: O(n), single pass through the input."
- "Space: O(n), hash map sized to the input."
- "Edge cases I want to handle: empty input, single element, duplicates."
Saying complexity before coding signals you understand the structure of the algorithm, not just the syntax. It also gives the interviewer a chance to nudge you if your claim is off, and that nudge is gold. If complexity is the part that trips you up, the guide on how to explain time complexity in an interview drills the exact phrasing.
Pass 4: Code while narrating (5-10 minutes)#
Now you write. Two rules:
- Speak every non-trivial line. "I'm initializing the result as an empty list. Now I iterate through the input, and for each element, I check whether its complement is in the hash map…"
- Don't apologize for typos. Fix them silently. Apologizing every time you backspace tanks your signal density.
When you finish, trace through your code with the same small example you used in Pass 2. Catch bugs live, while they're watching. End with: "Time complexity is O(n), space O(n), and edge cases I've handled are empty input, single element, and duplicates. Anything you'd like me to refactor?"
That last question matters more than it looks. It hands the interviewer back the lead and signals you can take feedback.
Your choice of language plays a part here too. Pick the one whose standard library lets you say less and do more, which the guide on how to choose a coding language for a CS interview breaks down by problem type.
A worked example: the four passes on one problem#
Seeing the script on one problem makes it stick. Take the classic "find two numbers in an array that add up to a target, return their indices" question. Here is roughly what the narration sounds like, pass by pass.
Pass 1, restate. "So I get a list of integers and a target, and I return the indices of two different elements that sum to the target. Can the list be empty? Can there be duplicates? Is there always exactly one answer? I'll assume one valid pair exists unless you tell me otherwise."
Pass 2, brute force. "The naive approach checks every pair with two nested loops. That's O(n²) time and O(1) space. Let me trace it on [2, 7, 11, 15] with target 9: the first pair, 2 and 7, already hits 9, so I return indices 0 and 1."
Pass 3, optimize. "The slow part is the inner loop searching for the partner number. If I store each value I've seen in a hash map, I can check for the complement in one lookup. That trades O(n) extra space for O(n) time."
Pass 4, code and trace. Write it while you talk, then run the same small array through the finished code:
def two_sum(nums, target):
seen = {} # value -> index where we saw it
for i, num in enumerate(nums):
need = target - num
if need in seen:
return [seen[need], i]
seen[num] = i
return [] # no pair found
"On [2, 7, 11, 15]: at index 0 I store 2. At index 1, I need 2, it's in the map, so I return [0, 1]. Time O(n), space O(n), and if there's no pair I return an empty list. Anything you'd like me to refactor?"
Notice what got said that silent code would never show: the assumptions, the baseline, the reason for the hash map and a live trace.
What to do when you get stuck#
Get stuck out loud. A silent stall, a long pause with no narration, reads as panic; a verbal stall, where you say what you're considering, reads as engineering. A few lines that keep the room with you:
- "I'm going to think for thirty seconds, is that okay?"
- "I don't immediately see the optimization. Let me try a smaller example."
- "What if I sort the input first? That's O(n log n), better than O(n²), worse than O(n)."
In our experience, the gap between a hire and a no-hire often comes down to whether you kept the room informed when you hit a wall. The technical bar matters less than you think; the communication bar matters more. The Pragmatic Engineer's writing on interview signal is good further reading on this.
Common mistakes when explaining a solution#
Most weak walkthroughs fail in the same handful of ways. Each one maps to a pass above, so the fix is usually just to stop skipping that pass.
- Typing in the first minute. You haven't restated the problem or asked about edge cases yet, so any bug in your reading of the question gets baked into the code. Go back to Pass 1.
- Hiding the brute force. Jumping straight to the clever answer looks like recall, not reasoning. Name the baseline first, even in one sentence.
- Announcing complexity only at the end. Say it before you code, as in Pass 3.
- Narrating syntax instead of intent. "Now I type for, i, in range" adds nothing. Say what the line does and why it's there.
- Filling silence with filler. Constant "um, so, okay" chatter lowers signal density just like silence does. A clear "let me think for a moment" beats both.
- Skipping the final trace. Running your small example through the finished code is where you catch your own bugs, which looks far better than the interviewer catching them.
How to practice explaining out loud#
Reading this method does almost nothing; saying it under time pressure builds it. As of 2026, nearly every CS new-grad loop runs over a webcam on a shared editor (CoderPad, HackerRank, or a plain Zoom screen-share), so practice into the same channel:
- Pull a medium problem from LeetCode or NeetCode, set a 30-minute timer, turn your camera and mic on, and screen-record the whole thing.
- Watch it back with the sound on. Count the silent stalls and the times you started coding before stating complexity.
- Re-run the same problem the next day and narrate the parts you skipped. The point isn't a fresh problem; it's a smoother walkthrough.
The fastest way to feel the gap between your silent code and your narrated code is to hear yourself once before it counts. You can run a practice round and walk through a problem out loud while a real-time coach surfaces the question and follow-ups, so the live interview isn't the first time you've said the answer in your own voice. If you want unlimited timed reps through the 2026 hiring season, see how live coaching turns a clean walkthrough into an offer, the same approach that starts free (60 minutes a month, no card), with Pro at $29 a month.
Need problems to practice on? The LeetCode 75 vs Blind 75 vs NeetCode 150 breakdown maps which list to grind first, and the coding interview cheat sheet collects the patterns most worth narrating fluently.
Key terms#
Coding interview: A live technical round where you solve a programming problem in a shared editor while an interviewer watches and grades your reasoning, not just your final answer.
Brute force: The most obvious correct solution, written with no optimization, usually the nested-loop version. Stating it first shows you can reason about a baseline before improving on it.
Time complexity: How a solution's runtime grows as the input grows, expressed in Big-O notation such as O(n) or O(n log n). Interviewers expect you to state it out loud before and after you code.
Big-O notation: The standard shorthand for the upper bound on how an algorithm scales, ignoring constants. It's the language interviewers use to compare approaches.
Signal density: How much useful evidence of your thinking you produce per minute. Narration raises it; silence and constant filler chatter both lower it.
Verbal stall: Saying what you're weighing while you're stuck ("let me try a smaller example") instead of going quiet. It reads as engineering; a silent stall reads as panic.
About the author: Sam K. is the founder of InterviewChamp.AI and writes about the modern tech interview from the inside: what changed, what works for new grads, and where the old playbook fails.
Originally published on InterviewChamp.AI
Frequently asked questions
- Should I write code first or explain my approach first?
- Explain first. If you start coding without saying your plan out loud, the interviewer can't help you when you get stuck, and they will help you if they understand where you're going. The plan should take 2-4 minutes before any code is written.
- What if I don't know the optimal solution?
- Say so out loud, then propose the brute force and code it. A brute force you actually finish beats an optimal solution you don't. Most interviewers grade on signal density, not on whether you hit O(n).
- How do I keep talking while I'm thinking?
- Narrate your tradeoffs ('I could use a hash map for O(1) lookup, but that's O(n) extra space; let me check if the input is bounded') even if you pause. Silence reads as stuck; tradeoff talk reads as engineering.
- Is it okay to ask the interviewer questions during the problem?
- Yes, especially in the first three minutes. Ask about edge cases, input size, whether duplicates are allowed, and whether you can mutate the input. Each question is a signal that you think before you type.
- What if I write code that doesn't compile?
- Walk through it line by line and find the bug yourself. Saying 'let me trace through this with a small example' and catching the bug live is a stronger signal than perfect code on the first try.
- How do you explain your code in a coding interview?
- Work top-down, not line-by-line. State the goal of each block before you write it ('this loop finds the complement for every element'), narrate the decisions and tradeoffs, and stay quiet during the obvious typing. The interviewer can only grade reasoning they can hear, so make the structure audible and skip the variable names.
- How do I walk through a LeetCode solution out loud when practicing alone?
- Record yourself solving a medium problem with your camera and mic on, then watch it back with the sound on. As of 2026 most loops are remote, so practicing into a webcam mirrors the real channel. You'll hear every filler word, every silent stall, and every place you jumped to code before stating complexity, the exact gaps a live interviewer marks down.