Code review interview practice
Modern engineering interviews increasingly evaluate code review and code comprehension alongside traditional problem solving. As developers rely more on AI coding assistants, the critical skill is verifying correctness: spotting missing guard clauses, identifying boundary bugs, and testing edge cases under pressure.
Each exercise here simulates a realistic code review round: a familiar problem with a persuasive initial implementation that fails on an unhandled boundary condition. Your role as a reviewer is to inspect the logic, articulate the defect, and implement the necessary fix in the browser.
Looking for the multi-file CoderPad Code Comprehension round?
Big tech companies (Google, Stripe, Meta) have expanded from single-function algorithms to full 200–500 line micro-codebases. Practice formulating adversarial test probes and surgical patches in our dedicated lab.
How to answer a code review interview: a 5-step framework
- Clarify the specification and intent: Confirm inputs, expected outputs, constraints, and time/space complexity targets before diving into the code.
- Trace the happy path first: Verify whether the core algorithm actually solves the primary case as described.
- Probe boundary and edge cases: Systematically test empty inputs, single elements, duplicate values, sign inversions, and off-by-one loop boundaries.
- Distinguish blockers from nits: Group your feedback clearly into correctness/security bugs (blockers) versus styling or micro-optimizations (nits).
- Deliver a constructive fix and verdict: Clearly articulate the root cause, write the minimal surgical patch, and verify against regression tests.
Debugging interview questions, with sample answers
The questions interviewers ask about debugging, and the shape of a strong answer. Each one links to exercises that practise it.
1. Walk me through how you debug a problem you have never seen before.
Reproduce it first, with the smallest input that fails. Read the full error, bottom line first. Form one hypothesis, test it with a print or a breakpoint, and change one thing at a time. Once fixed, write a test that would have caught it, so it cannot come back unnoticed.
Practise on code review exercises →2. The code runs without errors but the output is wrong. Where do you start?
Pick one input where you know the right answer, then compare expected and actual values step by step. The first variable that differs from what you worked out by hand is next to the bug. Logic bugs hide in conditions, operators and loop boundaries.
Logic error exercises →3. What is an off-by-one error, and how do you spot one?
A loop or index that goes one step too far or stops one short: < where <= was meant, or range(len(x) + 1). Test the edges: an empty list, one item, and the last item. Off-by-one bugs almost always show up at a boundary.
Off-by-one exercises →4. A bug only happens in production, not on your machine. What do you check?
Differences in input data, configuration, environment variables, versions and timing. Get the exact failing input from logs, then reproduce it locally with that input. If it depends on timing or load, suspect shared state or a race condition.
Async and race condition exercises →5. How do you debug an intermittent failure?
Intermittent usually means timing, shared mutable state, or uninitialised data. Log enough context to see which runs fail, run the test many times in a loop to make it fail on demand, and look for two pieces of code touching the same value without coordination.
Race condition exercises →6. What would you look for when reviewing this code for bugs?
Boundaries (empty input, first and last item), values that can be null or None, types that can be mixed, shared references that get mutated, missing awaits, and error paths that are swallowed. Say what each line assumes, and ask whether that assumption always holds.
Code review exercises →7. What is the difference between a shallow copy and a deep copy, and why does it cause bugs?
A shallow copy creates a new outer container but shares the objects inside it, so changing a nested list in the copy changes the original too. A deep copy duplicates everything. The bug looks like data changing somewhere you never touched it.
Mutation and copying exercises →8. How do you find which change introduced a bug?
If an older version worked, use git bisect: mark a good and a bad commit, and Git checks out the halfway point until it finds the first bad commit. Without history, remove half the code path at a time until the failure disappears.
Practise reading changed code →9. AI wrote this function and it passes the happy path. What could still be wrong?
AI-written code often misses edge cases: empty or single-item input, negative numbers, None or undefined, duplicate keys, and error handling. It can also call methods that do not behave the way the name suggests. Test the boundaries before trusting it.
AI-written code review exercises →10. When is it right to use a debugger instead of print statements?
Prints are quick for checking one or two values. A debugger is better when you do not yet know which value is wrong, when you need to inspect many variables, or when stepping into a function call. Either way, the goal is to see real values instead of guessing.
Python debugging tools →The exercises
Easy
Medium
- AI Attempt: The Two Sum TrapLogic
- AI Attempt: Remove all occurrencesLogic
- AI Attempt: The runner-up finderLogic
- AI Attempt: The anagram checkerLogic
- AI Attempt: Fibonacci starts one step aheadOff-by-one
- AI Attempt: The bracket checkerLogic
- AI Attempt: The missing number finderOff-by-one
- AI Attempt: Caesar cipher runs off the alphabetLogic
- AI Attempt: Merging two sorted listsLogic
- AI Attempt: Binary search misses the largest valueOff-by-one
- AI Attempt: Palindrome check passes "abca"Logic
- AI Attempt: Merging two sorted lists comes out unsortedLogic
- AI Attempt: Maximum subarray sumLogic
- AI Attempt: Character frequency counterNull and undefined
- AI Attempt: First non-repeating characterLogic
- AI Attempt: Rotating an array by kOff-by-one
- AI Attempt: Longest common prefixOff-by-one
- AI Attempt: Reversing a negative number crashesType
What you will practise
Questions
What is expected in a code review interview?
Interviewers evaluate your ability to read unfamiliar code, test hypotheses systematically, spot subtle edge cases, and communicate feedback clearly without jumping to random changes.
How does this differ from the Code Comprehension Lab?
These exercises focus on single-file code reviews of algorithmic functions. The Code Comprehension Lab (/comprehension) focuses on multi-file architecture, background workers, and service-layer simulations.
Which languages are used?
Python, JavaScript, Go, C++, Rust, and Java. You can practice in whichever language matches your target interview stack.
Is there a certificate?
Yes, free. Solving 8 interview challenges while signed in earns the Interview Debugging certificate, with a verification link for LinkedIn.