Rubber duck debugging is the old trick of explaining your code, line by line, to an inanimate duck until the bug becomes obvious. In a live coding interview you have something better than a duck: a person who is grading how you think. Used well, the technique finds your bug and earns points while you're stuck.
When you read your own code silently, you read what you meant to write. Saying each line out loud forces you to state what it actually does: "this loop runs from 0 to n, inclusive... wait, inclusive?" Off-by-one errors, wrong variable names and inverted conditions tend to surface on the first pass.
i=0, j=1, swap? yes.Good: "I expected left to be 2 here but it's 3, so my update must happen too early." That's a hypothesis the interviewer can follow and, often, nudge.
Less good: long silence followed by "hmm, it's broken." Or rapid random edits hoping something sticks. Both hide exactly what the interviewer is trying to evaluate.
< vs <=, len - 1 vs len.When you practise problems alone, debug out loud even though nobody is listening; record yourself once and listen back. It feels awkward the first few times, and it's much better to get past that awkwardness at home than in the interview.
Disclosure: I'm with Linkjob, which builds an AI interview copilot. The routine above needs nothing but a voice.