practice a little every day — you've got this ♡
Coding Interview Problems
Practice 6043 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.
- 6043
- Problems
- 2238
- Auto-graded
- 15
- Topics
- 274
- Added today
Showing 1261–1290 of 2791 results
- Data Structure DesignMediumModel answerDesign a Weighted Sampling Generator with Dynamic Updates
Implement a class for weighted sampling that supports O(1) sampling for static inputs and logarithmic updates for dynamic environments.
Data Structure Designdesign-dsheaps-sortingmath-bits - Arrays & HashingMediumAuto-gradedPrice Card Payments with Tiered Rates and Running Merchant Totals
Parse comma-separated payment rows, build a per-row rate from several rules plus a per-merchant running total, and round fees exactly to whole cents.
Arrays & Hashinghash-mapparsingsimulationrounding - Math & Bit ManipulationMediumAuto-gradedDelta-Method Variance of a Ratio of Two Sample Means
Apply a first-order Taylor expansion to get the approximate variance of a ratio of two correlated sample means, including the covariance term.
Math & Bit Manipulationdelta-methodvariancecovarianceratio-metrics - Math & Bit ManipulationMediumAuto-gradedGap in Days Between Two Calendar Strings Without Date Libraries
Parse two ISO-style date strings and compute the absolute day gap using manual Gregorian leap-year logic, without any date or calendar library.
Math & Bit Manipulationdate-arithmeticleap-yearstring-parsingmath - Arrays & HashingMediumAuto-gradedFind Accounts With Five Distinct Contacts in a Week
Sliding-window distinct counting per group: find callers who reach at least five different receivers within any 7-day span of their call log.
Arrays & Hashingsliding-windowhash-mapgroupingtimestamps - Data Structure DesignMediumAuto-gradedWork Queue Tracker with Owners, Closing, and Late Lookups
Simulate a task tracker driven by a list of operations, handling creation, reassignment, completion, and multi-key sorted queries while returning one result per operation.
Data Structure Designdesignhash-mapsortingsimulation - Trees & GraphsMediumAuto-gradedColumn-by-Column Readout of a Level-Order Encoded Tree
Compute the column-wise readout of a binary tree given as a level-order array, ordering nodes by column, then row, then value.
Trees & Graphsbinary-treebfshash-mapsorting - Heaps, Sorting & SearchMediumAuto-gradedValley Finder: Binary Search on an Unsorted Zigzag Array
Find a valley index in an array of adjacent-distinct integers in logarithmic time, using a fixed halving rule that makes the returned index deterministic.
Heaps, Sorting & Searchbinary-searcharraysinvariantsiterative - Data Structure DesignMediumModel answerCross-Venue Quote Book and Arbitrage Scanner
Build an in-memory engine that keeps the latest valid top-of-book quote per venue, expires old ones, and reports the most profitable buy-low/sell-high pair across venues.
Data Structure Designclass-designhash-mapmarket-dataedge-cases - Dynamic ProgrammingMediumAuto-gradedTallest Staircase Walk Across a Number Board
Find the longest chain of orthogonally adjacent cells with strictly increasing values in a 2D grid, testing DAG longest-path DP, memoization, and avoiding deep recursion.
Dynamic Programmingdynamic-programminggraphdfsmemoization - StringsMediumAuto-gradedLeft-to-Right Calculator Using Only Scalar State
Evaluate a no-parentheses arithmetic string with correct precedence and truncating division in one pass, using only a few scalar variables instead of a stack.
Stringsstring-parsingtwo-pointerssimulationconstant-space - Arrays & HashingMediumAuto-gradedAudit Purchase Events Against a Payment Ledger
Aggregate daily purchase metrics from event logs and reconcile two event snapshots against a ledger to judge whether a tracking fix worked, using hash-map grouping.
Arrays & Hashinghashingaggregationreconciliationdictionaries - Data Structure DesignMediumAuto-gradedPer-Key Cooldown Filter for a Timestamped Event Feed
Walk a time-ordered event feed and decide which events pass a 10-second per-key cooldown, where only accepted events restart the cooldown.
Data Structure Designhash-mapsimulationrate-limitingstreams - Arrays & HashingMediumModel answerSimulate Grid Rover Fleet Collision Logic
Simulate the concurrent step-by-step navigation of multiple automated grid rovers, handling collisions, static obstacles, and grid bounds.
Arrays & Hashingarrayssimulationmatrixhash-table - Arrays & HashingEasyAuto-gradedMost Frequently Booked Vehicle
Count how many booking records each vehicle has and return the ID with the highest count, breaking ties by the smallest ID.
Arrays & Hashinghash-mapcountingtie-breaking - Arrays & HashingMediumAuto-gradedInner Product of Two Index-Value Lists
Compute the inner product of two sparse vectors given as sorted index-value pairs by intersecting their indices with a linear merge, without building dense arrays.
Arrays & Hashingtwo-pointerssparse-vectorsorted-mergesimulation - Data Structure DesignMediumModel answerThread-Safe Ledger Accounts with Transfer and Absorb Operations
Design a concurrency-safe Account class supporting deposits, withdrawals, atomic transfers, and absorbing another account, while preventing overdrafts, deadlocks, and operations on closed accounts.
Data Structure Designoopconcurrencylockingdeadlock - Math & Bit ManipulationEasyModel answerAxial Tilt and Doubling Money: Two Estimation Questions
Explain the physical cause of hot summers and cold winters, then compute the balance of a $1,000 deposit that earns 100% interest compounded yearly for 20 years.
Math & Bit Manipulationestimationcompound-interestexponential-growthmental-math - Data Structure DesignMediumModel answerObject-Oriented Design for a Multi-Floor Garage Allocator
Design classes and an allocation API for a multi-floor garage that assigns the closest suitable bay to each vehicle, stays correct under concurrent requests, and handles a full garage.
Data Structure Designobject-oriented-designconcurrencyheaplow-level-design - Greedy & IntervalsMediumAuto-gradedEarliest Shared Free Slot Across Several Schedules
Find the earliest meeting slot of a given length that fits inside everyone's availability window and avoids every busy block, by intersecting windows and merging busy intervals.
Greedy & Intervalsintervalssweep-linesortingscheduling - Greedy & IntervalsMediumAuto-gradedMerge Event Windows Within Each Locality
Join two record lists by id, group event time ranges by locality, merge overlapping or touching ranges, and return the merged windows in a specified sort order.
Greedy & Intervalsintervalsmerge-intervalshash-mapsorting - Math & Bit ManipulationHardAuto-gradedStreaming Run/Bit-Pack Codec Session Simulator
Simulate a codec session that buffers int32 values, emits run-length and bit-packed blocks on flush, and decodes block lists back to integers.
Math & Bit Manipulationbit-manipulationcompressionsimulationtwos-complement - Data Structure DesignMediumAuto-gradedFunding Ledger with Rail-Specific Settlement and Window Caps
Simulate an ordered account ledger where each payment rail has its own settlement delay, cutoff-shifted window assignment, and per-window cap, and output the combined results.
Data Structure Designsimulationhash-mapheapdesign - Data Structure DesignMediumModel answerBuild a Three-Stage Signup Wizard with React Reducer State
Design a React wizard with profile, address and review stages, covering validation, guarded navigation, disabled controls, a submit spinner and server error display, plus scaling and performance trade-offs.
Data Structure DesignreactformsuseReducervalidation - Arrays & HashingMediumModel answerSimulate Cascade Board Game Outcome
Simulate a custom board game involving stack placing and directed toppling moves to determine the game outcome.
Arrays & Hashingarrayssimulationmatrix - Dynamic ProgrammingHardAuto-gradedMinimum Disorder When Interleaving Two Job Queues
Interleave two letter strings while keeping each one's order, minimizing out-of-order pairs; tests 2D prefix DP with O(1) transition costs from alphabet-count tables.
Dynamic Programmingdynamic-programmingstringsprefix-countsinterleaving - Arrays & HashingEasyAuto-gradedScore a Top-k Search Result Against Labeled Files
Clean a noisy ranked result list (missing, duplicated, unknown, or oversized) and compute precision and recall against ground-truth labels.
Arrays & Hashinghashingsetsmetricsinput-validation - Math & Bit ManipulationEasyAuto-gradedDetect a Rate Reversal Between Strata and Pooled Totals
Compare two groups' success rates per stratum and pooled, using exact integer cross-multiplication, to detect when a consistent stratum winner flips in the aggregate.
Math & Bit Manipulationsimulationfractionsaggregationsimpsons-paradox - StringsMediumAuto-gradedFewest Leading Digits Needed to Rearrange Into Each Word
For each query digit string, find the shortest prefix of a digit string containing enough of each digit to form it, using per-digit occurrence lists and a max over digits.
Stringsstringshashingcountingprecomputation - Trees & GraphsMediumAuto-gradedAudit a Workflow Run Against Dependencies and Precedence Rules
Check a run order against a task dependency graph, mandatory tasks and extra precedence pairs, while rejecting duplicates, unknown tasks and cyclic constraints.
Trees & Graphsgraphtopological-sortcycle-detectionhash-map