Interview Prep

Code Review

Practice finding bugs, design flaws, performance issues, and maintainability problems in real interview-style Java and Python code.

Start Here

How To Review Code In Interviews

Learn the checklist: correctness, edge cases, complexity, readability, maintainability, and design.

Showing 22 of 22 questions

How To Review Code In Interviews

A practical checklist for reviewing interview code: correctness, edge cases, readability, complexity, maintainability, and testing.

Code ReviewInterview StrategyDebuggingMaintainability

Python Code Review: Mutable Default Argument

Review a Python function that accidentally shares a default list across calls.

Code ReviewPythonFunctionsBugs

Java Code Review: == vs equals()

Review Java code that compares strings or objects using == instead of equals().

Code ReviewJavaStringsEquality

Java Code Review: Modifying a Collection While Iterating

Review Java code that removes items from a collection inside an enhanced for-loop.

Code ReviewJavaCollectionsBugs

Python Code Review: Bare except and Swallowed Errors

Review Python code that catches every exception and hides failures.

Code ReviewPythonExceptionsDebugging

Java Code Review: NullPointerException Risk

Review Java code that assumes inputs and object fields are never null.

Code ReviewJavaNull SafetyBugs

Python Code Review: Mutable Shared State

Review a Python class that accidentally shares a mutable list across all instances.

Code ReviewPythonClassesBugsState

Java Code Review: Bad HashMap Key Design

Review Java code that uses a mutable object as a HashMap key and causes lookups to fail after the key changes.

Code ReviewJavaHashMapequalshashCodeImmutability

Python Code Review: Missing Type Hints

Review Python code where missing type hints make the function contract unclear.

Code ReviewPythonType HintsMaintainability

Java Code Review: Resource Leak with Streams and Files

Review Java code that reads a file using a stream but forgets to close the underlying resource.

Code ReviewJavaFilesStreamsResource Management

Java Code Review: Missing equals() and hashCode()

Review Java code where HashSet or HashMap behaves incorrectly because a domain object does not implement equals() and hashCode().

Code ReviewJavaHashMapHashSetEquality

Java Code Review: Mutable Objects Inside HashSet

Review Java code where an object is inserted into a HashSet and then mutated, causing contains() to fail unexpectedly.

Code ReviewJavaHashSethashCodeMutability

Java Code Review: Optional Misuse

Review Java code that uses Optional in a way that adds complexity or defeats its purpose.

Code ReviewJavaOptionalNull Handling

Java Code Review: Thread Safety Assumptions

Review Java service code that uses a shared HashMap cache without considering concurrent requests.

Code ReviewJavaConcurrencyHashMapThread Safety

Java Code Review: Long Method / God Method

Review a Java service method that mixes validation, pricing, payment, persistence, inventory, and notifications in one place.

Code ReviewJavaMaintainabilityDesignRefactoring

Code Review: N+1 Database Query Pattern

Review backend code that performs one database query for a list, then one additional query for each item in the list.

Code ReviewDatabasePerformanceN+1ORMJava

Python Code Review: Mutable Class Variable

Review a Python class that accidentally shares a list across all instances.

Code ReviewPythonClassesMutable State

Python Code Review: Inefficient List Lookups

Review Python code that repeatedly checks membership in a list and accidentally creates an O(n²) performance problem.

Code ReviewPythonPerformanceData Structures

Python Code Review: Using Exceptions for Control Flow

Review Python code that uses broad try/except blocks for normal lookup logic and silently hides different failure cases.

Code ReviewPythonExceptionsReadability

Python Code Review: Hidden Side Effects

Review Python code that unexpectedly mutates a caller's list and dictionaries while appearing to return cleaned data.

Code ReviewPythonMutabilityMaintainability

Python Code Review: Magic Numbers

Review Python code that hides business rules behind unexplained numeric values.

Code ReviewPythonMaintainabilityReadability

Python Code Review: Deep Nesting

Review Python code where the main logic is buried under many nested if statements.

Code ReviewPythonMaintainabilityReadability