Loading…
Practice logic, architecture, and data structure faults — curated problems trusted by engineers at top companies.
This stored procedure runs a subquery inside a loop for each user, causing severe performance degradation at scale.
A pagination query returns one extra row on every page, causing duplicate entries in the UI. Find the line causing the issue.
This query is supposed to count orders per customer but throws a SQL error in strict mode. Identify the faulty line.
A report of all products and their sales totals silently drops products with zero sales. Find the architectural fault.
This stored procedure runs a subquery inside a loop for each user, causing severe performance degradation at scale.
This recursive CTE to traverse an org chart runs forever and crashes the database. Find the missing line.
This stack implementation crashes when pop() is called on an empty stack. Identify the missing guard.
Deleting a node from the middle of a singly linked list leaves a dangling reference. Find the fault.
This binary search overflows on large arrays due to an integer arithmetic fault. Find the problematic line.
This custom hash map hangs when the load factor exceeds 0.75 because the resize logic has a cycle bug.
This BST insert function places nodes on the wrong side of the root for equal values, breaking in-order traversal.
All timeout callbacks log the same value instead of their loop index. Find the scoping fault.
This async function swallows all errors silently, making failures impossible to debug in production.
This Redux-style reducer mutates state directly, causing React to miss re-renders.
A dashboard that fetches three independent data sources crashes entirely if any single source fails.
Event listeners attached to dynamically created elements are never removed, causing a memory leak over time.
This function accumulates results across calls because of a classic Python pitfall. Find the fault.
A list of lambda functions all return the last value of the loop variable instead of their own captured value.
This function processes a generator twice, but silently produces empty results on the second pass.
A multithreaded download manager counts completed tasks incorrectly because the counter is not thread-safe.
Two modules import each other at the top level. One module sees an incomplete version of the other, causing an AttributeError at runtime.
A query that should use an index runs a full table scan instead. Find the line that defeats the index.
A query counting opt-in users returns an inflated number. Find the line with the wrong aggregate.
A maintenance script to reset trial users accidentally updates every row in production. Find the missing constraint.
Two concurrent transactions occasionally deadlock because they acquire locks in opposite order. Find the architectural fault.
A leaderboard query ranks players globally instead of per-game, returning wrong rankings. Find the window function fault.
A query to find pairs of employees in the same department returns a massive result set with duplicates and self-pairs.
A query filters rows before aggregation but uses HAVING, causing a full table scan on 10 million rows.
A task queue processes jobs in LIFO order instead of FIFO, so the oldest jobs never execute.
A graph BFS hangs on any graph with cycles because nodes are revisited indefinitely.
A memoized longest common subsequence function returns wrong answers for some inputs because the cache key is ambiguous.
A priority queue meant to always pop the smallest element actually returns the largest due to a comparator bug.
This quicksort implementation has O(n²) worst-case performance on already-sorted arrays in production.
Deleting one word from a trie removes other words that share a prefix with it.
A null check using typeof passes for null values and crashes downstream code.
A financial calculation comparison returns false for values that should be equal due to floating point precision.
A deep merge utility allows an attacker to inject properties into Object.prototype, affecting all objects in the application.
A Node.js API route hangs all concurrent requests while processing a large CSV file synchronously.
A promise chain continues executing after an error because a .catch in the middle silently swallows and recovers.
Modifying a cloned config object also mutates the original because the clone is shallow.
A data processing script migrated from Python 2 produces slightly wrong averages due to a division behavior change.
A function that clones a 2D board for game state unexpectedly mutates the original board.
Building a large report string by concatenation in a loop is 100x slower than expected. Find the performance fault.
An async web scraper stalls all concurrent coroutines whenever any single page takes time to process.
Adding more threads to a CPU-intensive image processor does not improve speed — it actually gets slower.
A log parser leaks file handles under error conditions because files are opened without a context manager.
An API client silently swallows KeyboardInterrupt and SystemExit because the exception handler is too broad.
A sortable list reuses the wrong component instances after reordering because of a bad key prop.
A filtered list gets out of sync with its source because derived state is stored in separate useState instead of being computed.
A memoized event handler always uses the initial prop value because the dependency array is empty.
A lazily loaded component crashes the entire page tree instead of showing a loading state when the chunk is still downloading.
A keyboard shortcut handler always uses the initial state value because it is registered once without cleanup.
A counter incremented three times in a row only increases by one instead of three due to React batching.
A parent component cannot focus a custom input component because the ref is silently dropped.
A useEffect hook reads stale state because a dependency is missing from the array, causing the callback to close over an old value.
A React.memo-wrapped child re-renders on every parent render despite no visible prop changes.
An async fetch inside useEffect tries to update state after the component unmounts, causing a React warning and potential memory leak.
Every component consuming this context re-renders when any part of the context value changes, even if they only use one field.
This component triggers an infinite render loop because a useEffect both reads and writes the same state without a condition.
This method crashes with a NullPointerException when the map lookup misses, due to autoboxing.
A login check passes for equal-looking strings from different sources but fails in production due to reference comparison.
This method throws a ConcurrentModificationException when filtering out expired sessions from a list.
A utility class manually instantiated with new throws a NullPointerException on its @Autowired dependency.
Calling a transactional method from another method in the same class silently runs without a transaction.
Listing all orders with their customer names issues one extra query per order instead of a single join.
This function panics at runtime when adding the first entry to a freshly declared map.
Launching a goroutine per item in a loop prints the same final value for every goroutine instead of each item.
Under certain error paths, this function leaks a goroutine forever because nothing ever reads from its result channel.
A background job that calls an external API occasionally hangs indefinitely, blocking the whole worker pool.
A high-throughput client exhausts ephemeral ports under load because it never reuses connections.
A protocol parser drops the tail of large messages because it assumes one read() call fills the entire buffer.
A routine tag update on an S3 bucket triggers Terraform to destroy and recreate the bucket, causing data loss.
Pods restart repeatedly during traffic spikes even though the application is healthy, just slow to respond.
Two CI pipelines running in parallel occasionally corrupt the Terraform state file, losing track of real infrastructure.
Every deploy re-installs all npm dependencies from scratch, even when only application code changed.
Every deployment takes the full grace period to kill containers instead of shutting down cleanly.
A private npm registry token used during the build is recoverable from the published image, even though the final stage never references it.
A service with a slow startup (schema migrations, JIT warmup) never reaches a ready state in production — the pod restarts every 30 seconds in an endless CrashLoopBackOff.
An endpoint that was fast for months starts timing out and spiking API memory once the largest customer crosses a few hundred thousand records.
Customers are occasionally charged twice for a single checkout, always when the network was slow and the client retried.
Every five minutes, almost exactly on the minute, database CPU spikes to 100% for a few seconds and latency across the whole site degrades.
A multi-tenant reporting page intermittently shows one company data that belongs to a different company. It is never reproducible in staging, which has a single tenant.
Occasionally a customer receives two confirmation emails for one order and stock is decremented twice, usually after a broker or consumer restart.
During a deploy, a handful of invoices simply never get generated. There is no error in the logs and the queue is empty.
A database password rotates weekly, yet a leaked container image from months ago still yields working credentials.
The dashboard is the slowest page in the product, and whenever the recommendations service degrades the entire dashboard returns 500 even though it is a minor widget.
A discounted cash flow model consistently returns an enterprise value a few percent above every cross-check. The cash flow projections and the WACC have both been independently verified as correct.
A perpetuity-growth terminal value calculation returns a large negative number, which flips the sign of the entire valuation.
A three-statement model refuses to balance. The gap between assets and liabilities plus equity grows larger each projected year, and it is almost exactly the size of accumulated depreciation.
A model that behaved correctly at first now reports the same interest expense in every scenario, including one where the company repays all of its debt.
In an LBO model the leverage ratio plateaus instead of falling, and the sponsor return looks far worse than the same deal modelled by the counterparty.
A five-year revenue build shows healthy growth in year one and then a flat line, even though the growth assumption is applied to every year.