practice a little every day — you've got this ♡
Coding Interview Problems
Practice 5974 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.
- 5974
- Problems
- 2212
- Auto-graded
- 15
- Topics
- 269
- Added today
Showing 151–180 of 2762 results
- Trees & GraphsMediumAuto-gradedCounting Separate Land Patches in a 0/1 Grid
Count connected components of 1-cells in a binary grid using only up/down/left/right adjacency, via flood fill or union-find.
Trees & Graphsgraphbfsconnected-componentsmatrix - Arrays & HashingMediumAuto-gradedRepeat Visitors Across UTC Days in an Event Feed
Normalize ISO 8601 timestamps to UTC dates and use hashing to find users active on at least two distinct UTC calendar days.
Arrays & Hashinghashingdatetimetimezonelogs - Math & Bit ManipulationMediumAuto-gradedCover an IPv4 Address Run with the Fewest Prefix Blocks
Split a run of consecutive IPv4 addresses into the fewest aligned power-of-two prefix blocks using 32-bit integer and lowest-set-bit reasoning.
Math & Bit Manipulationbit-manipulationgreedyipv4cidr - Data Structure DesignEasyModel answerFleet Command Console for Grid-Walking Robots
Design a text-driven controller that manages several robots on an unbounded grid, handling turns, steps, selection, error cases and cell collisions.
Data Structure Designsimulationhash-mapcommand-parsingstate-machine - Arrays & HashingMediumAuto-gradedLongest Daily Purchase Streak for Each Customer
Group purchase records by customer, collapse same-day duplicates, and find the longest run of back-to-back calendar days, reporting results sorted by customer id.
Arrays & Hashinghashingsortingdatesgaps-and-islands - Trees & GraphsMediumAuto-gradedSmallest-Label Build Sequence with Cycle Check
Produce the lexicographically smallest valid ordering of a dependency graph using a min-heap variant of Kahn's algorithm, returning an empty list if a cycle makes ordering impossible.
Trees & Graphstopological-sortheapgraphcycle-detection - Greedy & IntervalsMediumAuto-gradedSmallest-ID Room Allocation for Booking Time Slots
Partition half-open time intervals across the fewest resources, deterministically giving each booking the lowest-numbered free resource, using sorting and two heaps.
Greedy & Intervalsintervalsheapgreedysorting - Data Structure DesignMediumAuto-gradedSimulate an Expiring Key-Value Store with Read-Through Loads
Simulate a time-aware key-value store with expiry, stale entries that stay stored, and a read-through fetch whose loader outcome is given as data, with strict input validation.
Data Structure Designsimulationhash-mapcachevalidation - Data Structure DesignMediumAuto-gradedCanvas Replay with Undo and Redo History
Simulate a pixel canvas with draw, erase, flood fill, undo and redo, returning a canvas snapshot after every command while keeping the history stacks consistent.
Data Structure Designstacksimulationflood-fillundo-redo - Trees & GraphsMediumAuto-gradedCollect Path-Tagged Errors from a Nested Payload Schema Check
Recursively walk a JSON-like value alongside a simplified schema and report type and missing-key errors with exact paths, in deterministic order.
Trees & Graphsrecursiondfsjsonvalidation - Dynamic ProgrammingHardModel answerMaximize Allocation Across Server Pools with Migration Limits
Aggregate daily resource usages and calculate optimal allocations under unrestricted and migration-bounded pool selection constraints using dynamic programming.
Dynamic Programmingarraysdynamic-programminggreedy-intervals - Data Structure DesignMediumModel answerBuild a Weighted Hash Ring for Sharding Keys Across Servers
Design a hash ring with weighted virtual nodes that assigns keys to servers, supports adding and removing servers with little key movement, and handles collisions and concurrency.
Data Structure Designconsistent-hashingvirtual-nodesbinary-searchthread-safety - Trees & GraphsMediumAuto-gradedCount Node Changes Between Two Keyed Hierarchies
Compare two keyed trees in parallel and count changed nodes, where a changed value replaces its whole subtree and unmatched nodes count with their subtrees.
Trees & Graphstreedfshash-mapsubtree-size - Data Structure DesignMediumAuto-gradedPoint-in-Time Set Views from an Operation Log
Simulate a set that processes add, remove, contains and snapshot operations, where each snapshot must be an independent frozen copy of the set at that moment.
Data Structure Designdesignhash-setsnapshotsimulation - Data Structure DesignMediumAuto-gradedSimulate a Fixed-Size Cache Under LRU or LFU Eviction
Replay a list of get/put operations on a bounded cache that evicts by recency or by frequency (ties broken by recency), and return the result of each operation.
Data Structure Designhash-mapordered-dictlrulfu - Data Structure DesignMediumModel answerFunction Composition Twice and Core Container Cost Comparison
Write a helper that feeds a function's output back into itself, explain closures and side effects, then compare arrays, linked lists, stacks and queues by operation cost.
Data Structure Designhigher-order-functionsclosuresside-effectscomplexity-analysis - Arrays & HashingMediumAuto-gradedDistinct Value Foursomes Hitting a Target Total
Find every distinct set of four values, taken from different positions, that add up to a target, with no repeated value combinations in the output.
Arrays & Hashingtwo-pointerssortingdeduplicationk-sum - Arrays & HashingEasyAuto-gradedCount Shoppers With Visits on Two or More Days
Group log entries by person and ignore repeats on the same day, then count how many people appear on at least two different calendar days.
Arrays & Hashinghash-sethash-mapgroupingdeduplication - Stacks & QueuesMediumAuto-gradedCollapse Adjacent Edits Before Applying Them to a Text Buffer
Simulate a queue of insert and format edits, merging adjacent inserts and dropping repeated adjacent formats, then return the final text and ordered list of applied styles.
Stacks & Queuesstacksimulationcommand-patternstrings - Data Structure DesignMediumAuto-gradedRing-Buffer Deque with Constant-Time Indexing
Build a double-ended queue on a resizable circular array so index lookups are O(1), then replay a command list against it and report each result.
Data Structure Designcircular-bufferdequedynamic-arrayamortized-analysis - Trees & GraphsMediumAuto-gradedExtract Text From Matching Elements in Messy Markup
Parse a forgiving HTML string into an element tree in one pass, then collect each matching element's combined text in document order using an iterative depth-first traversal.
Trees & Graphsparsingtreedfsstack - Trees & GraphsMediumAuto-gradedTotal Value of Bit-Strings Along a Tree's Leaf Paths
Decode a level-order bit tree with skipped None slots, then sum the binary values read along each root-to-leaf path, testing BFS parsing and DFS with a running accumulator.
Trees & Graphsbinary-treedfsbfslevel-order-parsing - Heaps, Sorting & SearchMediumAuto-gradedEvaluate a Broken-Line Curve at a Query Position
Sort scattered points by x, then find the y on the connecting line at a query x, interpolating inside the range and extending the end segments outside it.
Heaps, Sorting & Searchbinary-searchsortinginterpolationgeometry - Math & Bit ManipulationEasyModel answerImplement Iterative and Recursive Factorial with Integer Squares
Write iterative and recursive factorial functions alongside a sequence of integer squares, focusing on input validation, edge cases, and stack vs. loop complexity.
Math & Bit Manipulationmathrecursioniterationpython - Greedy & IntervalsMediumAuto-gradedCombine Overlapping Time Intervals
Consolidate overlapping and adjacent closed intervals into a minimal list of disjoint intervals using sorting.
Greedy & Intervalsarraysgreedy-intervalssorting - Heaps, Sorting & SearchMediumAuto-gradedOrder Transformed Values of a Sorted Array
Apply a quadratic mapping to a sorted list of numbers and return the sorted results in O(n) time.
Heaps, Sorting & Searchtwo-pointersarraysmath - Trees & GraphsMediumAuto-gradedClosest-Pair Dispatch of Couriers on a Walled Grid
Match couriers to parcels by repeatedly choosing the globally closest pair, using BFS shortest paths on a grid with walls and deterministic tie-breaking.
Trees & Graphsbfsgridgreedysorting - Stacks & QueuesMediumAuto-gradedNormalize a Filesystem Location String
Reduce an absolute Unix-style path to its canonical form by resolving repeated slashes, current-directory and parent-directory segments, using a stack.
Stacks & Queuesstackstring-parsingsimulationpaths - Math & Bit ManipulationMediumAuto-gradedCount Starting Numbers for Consecutive Sums
Determine how many positive integers can serve as the starting element of a sequence of consecutive positive integers that sums to a target value.
Math & Bit Manipulationmathnumber-theoryarithmetic-progression - Trees & GraphsMediumAuto-gradedFind the k-th Value in a Level-Order Encoded Tree's Inorder Sequence
Decode a level-order binary tree with null gaps, then return the k-th value in its inorder sequence, or -1 if fewer than k nodes exist.
Trees & Graphsbinary-treeinorder-traversaliterative-traversalstack