BugHunt

Debugging interview questions

More interviews now include a debugging round: here is some code, it is wrong, find out why. It is also the daily reality of working with AI assistants, which produce code that reads well and passes the obvious test, then fails on the case nobody tried.

Each exercise here is a classic interview problem — palindromes, FizzBuzz, two-sum, anagrams, balanced brackets — with an AI-written solution that has exactly one bug. Your job is the interviewer's: find the input that breaks it, then fix it.

See the exercises

How to approach a debugging question in an interview

  1. Restate the contract out loud: inputs, outputs, and what should happen at the edges (empty input, one item, duplicates, negatives).
  2. Run the obvious example in your head first, then the edge cases. Most planted bugs only show at an edge.
  3. When you find a failing input, say why it fails before you touch the code. Interviewers grade the reasoning more than the fix.
  4. Make the smallest change that fixes the cause, then re-check the cases that worked before.
  5. Mention what you would test next. It shows you know a fix is a hypothesis until the tests agree.

The exercises

What you will practise

Questions

Why AI-written code?

Because reviewing generated code is now a core part of the job, and its bugs are a particular kind: plausible, confident, and wrong only on the edge case.

Which languages?

Python and JavaScript. Pick whichever you will use in the interview.

Is there a certificate?

Yes, free. Fixing 8 of these while signed in earns Interview Debugging, with a verification link for LinkedIn.