practice a little every day — you've got this ♡
Coding Interview Problems
Practice 5965 original coding, SQL, system design, machine learning and behavioral problems across 15 topics. Coding and SQL problems run against hidden test cases right in your browser; every problem has hints and a worked solution, free.
- 5965
- Problems
- 2208
- Auto-graded
- 15
- Topics
- 271
- Added today
Showing 1–30 of 650 results
- Data Structure DesignMediumModel answerDeadlock-Free Atomic Funds Movement Between Shared Accounts
Design a concurrent transfer operation over an in-memory account store that never loses updates, is all-or-nothing, preserves total money, and cannot deadlock.
Data Structure Designconcurrencylockingdeadlockatomicity - Data Structure DesignMediumModel answerPython ABCs and the Three Kinds of Methods Explained
Explain how abstract base classes work in Python and how instance, class and static methods differ in binding, inheritance behavior and typical use.
Data Structure Designpythonoopabstract-classesclassmethod - Trees & GraphsHardModel answerConstruct Non-Conflicting Queens Configurations
Compute all possible configurations of n non-attacking queens on an n x n board using stateful depth-first search.
Trees & Graphsbacktrackingrecursiondepth-first-search - Data Structure DesignMediumModel answerHandling Seekable Body Replays on 307 Redirects in Python requests
Debug and implement stateful body rewind logic for seekable file-like streams when executing HTTP 307 redirects in an HTTP client library.
Data Structure Designpythonhttpdebuggingstreams - Trees & GraphsHardModel answerGrid Partitioning and Navigating Safe Subregions
Construct a valid contiguous layout for multiple crop zones on a grid and find the shortest path avoiding edge-touching zones.
Trees & Graphstrees-graphsgridbfsconstructive-algorithms - Data Structure DesignMediumModel answerDesign a Blackjack Game Engine
Architect an object-oriented Blackjack engine handling multi-deck shoes, split hands, and soft/hard total calculations.
Data Structure DesignData Structure DesignObject-Oriented DesignState Machine - Trees & GraphsMediumModel answerGraph Toolkit for Scene and Dependency Graphs: Sort, Traverse, Route
Implement topological sort, BFS, DFS and Dijkstra on a dependency graph, then discuss CSR versus adjacency lists, CPU/GPU parallel traversal, and deterministic testing.
Trees & Graphstopological-sortbfs-dfsdijkstracsr - Data Structure DesignMediumModel answerBuild a Batch Grayscale Thumbnailer with Worker Pools
Design and code a Pillow-based batch tool that grayscales and shrinks images, then scale it to many large files with multiprocessing, robust error handling, bounded memory and benchmarks.
Data Structure Designpythonpillowmultiprocessingconcurrency - Data Structure DesignHardModel answerBuild a Thread-Safe Dual-Resource Allocator
Design a concurrency controller that manages exclusive access to two distinct targets while preventing deadlocks and invalid release calls.
Data Structure Designconcurrencymultithreadinglockssynchronization - Data Structure DesignMediumModel answerDebugging a LinkedHashMap-Based Eviction Cache in Java
Review a Java cache built on LinkedHashMap that evicts the wrong entries, find each defect, write minimal failing tests, and produce a corrected version.
Data Structure Designlru-cachejavalinkedhashmapdebugging - Data Structure DesignMediumModel answerAudited Lazy File Streaming with Generators, Decorators and with
Build a decorator that audits a chunked file-reading generator's lifecycle, with deterministic file cleanup on completion, early exit, errors and garbage collection.
Data Structure Designpythongeneratorsdecoratorscontext-managers - Heaps, Sorting & SearchMediumModel answerFind Index of Local Minimum Using Binary Search
Locate a local minimum in an array of integers in logarithmic time while handling flat regions and boundaries.
Heaps, Sorting & Searcharraysbinary-searchalgorithms - Heaps, Sorting & SearchMediumModel answerImplement Weighted Index Selector with Efficient Retrieval
Design a data structure that accepts an array of positive item weights and samples indices proportional to their relative weight values.
Heaps, Sorting & Searchbinary searchprefix sumrandom samplingdesign-ds - Data Structure DesignMediumModel answerMaking a Memoizing Python Function Safe for Many Threads
Critique a Python function that caches expensive results in a dict, then make it thread-safe so each input is computed once, without blocking cache hits or unrelated inputs.
Data Structure Designpythonconcurrencycachinglocking - Stacks & QueuesMediumModel answerLine of Sight Counts for Each Person in a Row
For each person in a row, count how many people further right they can see when anyone standing between must be shorter than both of them. Needs an O(n) approach.
Stacks & Queuesmonotonic-stackarraysamortized-analysisnext-greater-element - Data Structure DesignMediumModel answerVersioned Follow Graph with Time-Travel Queries and Suggestions
Build an in-memory directed follow graph with cheap snapshots, historical edge lookups, and a friends-of-friends suggestion ranking with id tie-breaks.
Data Structure Designgraphsnapshotsbinary-searchheap - Data Structure DesignMediumModel answerLive Scoreboard Engine for One Tennis Game
Process a sequence of point winners for a single tennis game and print the correct score after each point, including deuce, advantage and the win-by-two rule.
Data Structure Designsimulationstate-designclass-designedge-cases - Data Structure DesignMediumModel answerSnapshot and Restore for an In-Memory String Map
Build an in-memory string map in C++ that can dump its full state to a byte buffer and rebuild it, handling arbitrary bytes, corrupt input, and failed restores safely.
Data Structure Designserializationbinary-formathash-mapinput-validation - Heaps, Sorting & SearchMediumModel answerRolling Window Medians with Two Heaps and Lazy Removal
Return the median of every length-k window of an integer array in O(n log k) time, handling duplicates, removals of departing elements, and the even-k convention.
Heaps, Sorting & Searchsliding-windowheapmedianlazy-deletion - Data Structure DesignMediumModel answerThread-Safe Ledger for Courier Payouts and Client Invoices
Design an in-memory, thread-safe ledger that upserts delivery records and serves instant per-courier earnings and per-client invoice totals in integer cents.
Data Structure Designconcurrencyhash-mapincremental-aggregationlow-level-design - Dynamic ProgrammingMediumModel answerPrune Minimum Nodes from Tree to Satisfy Height Budget
Determine the minimal set of non-root node deletions required to trim a multi-child tree's height down to a target limit under node-promotion rules.
Dynamic Programmingtrees-graphsdynamic-programmingtree-dp - Heaps, Sorting & SearchMediumModel answerThree Classics: Spaced Characters, Merged Streams, Cloned Lists
Solve three linked tasks: rearrange a string so no neighbors match, merge k sorted linked lists, and deep-copy a linked list whose nodes carry an extra arbitrary pointer.
Heaps, Sorting & Searchheapgreedylinked-liststring - Data Structure DesignMediumModel answerDesign a Custom CSV Parsing and Filtering Engine
Implement an in-memory CSV query processor with auto-type inference and polymorphic field filtering.
Data Structure Designparsingdesign-dsstringsarrays - Trees & GraphsEasyModel answerCount Activations per Node in a Cascade Graph
Given a DAG of task dependencies and one start node, compute how many times each node fires when every activation fans out once along every outgoing edge.
Trees & Graphsdagtopological-sortpath-countinggraph-traversal - Heaps, Sorting & SearchMediumModel answerAssign Meetings to Rooms and Find the Most-Used One
Simulate meetings being placed into n numbered rooms, delaying them when all rooms are full, then report the room that hosted the most meetings, preferring the lowest index on ties.
Heaps, Sorting & Searchheapsimulationpriority-queueintervals - Heaps, Sorting & SearchMediumModel answerTop Words in a Huge Text File Under Tight Memory
Count word frequencies in a text file far larger than RAM, with explicit tokenization rules and an efficient exact top-K, and analyze time, memory and disk costs.
Heaps, Sorting & Searchword-countstreamingexternal-memorytop-k - Math & Bit ManipulationMediumModel answerRunners Dodging Bouncing Sentries Along a Track
Count how many runners, released one per time unit, cross a track without ever sharing a cell at the same integer time with a sentry that bounces back and forth inside a fixed range.
Math & Bit Manipulationsimulationmodular-arithmeticperiodic-motionparity - Math & Bit ManipulationEasyModel answerInvert Bit at Specific Index
Invert the bit at a given index in a non-negative integer using bitwise operations.
Math & Bit Manipulationmath-bitsbit-manipulationmath - Arrays & HashingMediumModel answerWeighted Random Index Sampling and Exclusion Product Array
Implement weighted index sampling with binary search and an exclusion product array without division in O(1) auxiliary space.
Arrays & Hashingarraysbinary-searchprefix-sum - Data Structure DesignMediumModel answerTurn-Based Squad Combat Engine with Deterministic Ordering
Simulate a fight between two squads of monsters with fixed turn order, weakest-first targeting and a damage formula, and return the ordered list of attack events.
Data Structure Designsimulationobject-oriented-designsortingtie-breaking