practice a little every day — you've got this ♡
Coding Interview Problems
Practice 6036 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.
- 6036
- Problems
- 2235
- Auto-graded
- 15
- Topics
- 273
- Added today
Showing 1051–1080 of 2134 results
- Greedy & IntervalsEasyAuto-gradedBest Single Buy-Sell Gain from Daily Quotes
Find the largest gain from buying on one day and selling on a later day in a list of daily prices, returning 0 if no gain is possible.
Greedy & Intervalsgreedyarraysrunning-minimumsingle-pass - Math & Bit ManipulationEasyAuto-gradedAnnual Profit and Break-Even Value for a Lounge Menu Item
Compute a per-site annual operating result and the break-even per-unit benefit from visit volume, uptake rate, unit cost, unit benefit, a one-time setup cost, and a time horizon.
Math & Bit Manipulationarithmeticbreak-evensimulationedge-cases - Arrays & HashingMediumAuto-gradedMean Front-to-Rear Lens Flips Across Recorded Sessions
Group event logs by session, sort chronologically, count adjacent front-then-rear transitions, and average over all sessions, including sessions with zero flips.
Arrays & Hashinghash-mapgroupingsortingsimulation - Dynamic ProgrammingMediumAuto-gradedDistinct Value Groups Summing to a Goal, Each Item Used Once
Enumerate every distinct multiset of values from a list with repeats that adds up to a goal, using each position at most once, via sorted backtracking with duplicate skipping.
Dynamic Programmingbacktrackingrecursionsortingcombinations - Heaps, Sorting & SearchEasyAuto-gradedClosest Points to a Query Vector, Ranked with Index Tie-Break
Select the k dataset points nearest to a query in n-dimensional space, ordered by distance, with ties resolved by smaller index.
Heaps, Sorting & Searchk-nearest-neighborssortingheapeuclidean-distance - Trees & GraphsMediumAuto-gradedWords Traced Through a Letter Board
Find every dictionary word that can be traced through orthogonally adjacent cells of a letter board without reusing a cell, using backtracking guided by a prefix tree.
Trees & Graphsbacktrackingtriedfsgrid - Arrays & HashingEasyAuto-gradedEarliest Non-Repeating Event Name in a Sequence
Find the earliest entry in a list of strings that occurs exactly once overall, or return an empty string, testing frequency counting combined with preserved order.
Arrays & Hashinghash-mapcountingstringstwo-pass - Data Structure DesignMediumAuto-gradedAdmit or Deny Requests Under a Per-Client Rolling Quota
Process a time-ordered request log and decide per request whether a client is under its quota in a rolling time window, counting only previously admitted requests.
Data Structure Designsliding-windowdequehash-mapsimulation - Arrays & HashingEasyAuto-gradedLocate the Two Positions That Add Up to a Goal Value
Find the single pair of distinct positions in an integer list whose values add up to a goal, using a one-pass lookup instead of checking every pair.
Arrays & Hashinghash-maparraycomplement-lookup - Greedy & IntervalsMediumAuto-gradedFewest Conference Rooms for a Day of Bookings
Compute the minimum number of rooms needed to host all time-range bookings when back-to-back bookings may reuse a room, testing sweep-line or heap-based interval reasoning.
Greedy & Intervalsintervalsheapsweep-linesorting - Heaps, Sorting & SearchMediumAuto-gradedLeftmost Match in a Sorted Sequence Without a Known Size
Find the first index of a target in a sorted list while the search pretends its length is unknown, using doubling probes followed by a lower-bound binary search.
Heaps, Sorting & Searchbinary-searchexponential-searchduplicatessorted-array - Stacks & QueuesMediumAuto-gradedLargest Block Under a Skyline of Columns
Compute the largest rectangle that fits under a row of unit-width columns, testing monotonic stack usage and boundary reasoning over contiguous ranges.
Stacks & Queuesmonotonic-stackarrayhistogramcontiguous-range - Trees & GraphsMediumAuto-gradedNearest Exit Distance Map on a Walled Grid
Compute, for every open cell of a grid with walls and exits, the shortest 4-directional distance to any exit using multi-source BFS, leaving unreachable cells unchanged.
Trees & Graphsbfsgridmulti-source-bfsmatrix - Greedy & IntervalsMediumAuto-gradedFewest Drivers to Cover Every Trip Without Overlap
Find the fewest drivers needed to serve all trips given [start, end) times, which reduces to the peak number of simultaneous trips and tests sweep-line or heap handling of boundaries.
Greedy & Intervalsintervalssweep-lineheapgreedy - Arrays & HashingEasyAuto-gradedPer-Row Offset From Group Average in a Record List
Tests group-then-broadcast logic: compute each group's mean over a list of dict records, then attach each row's difference from its group mean while preserving order.
Arrays & Hashinghash-mapgroup-byaggregationsimulation - Greedy & IntervalsMediumAuto-gradedFind the First Free Slot After Busy Minutes in Text Schedules
Parse text schedule entries into inclusive minute intervals, merge them, and find the earliest k-minute free slot that follows the first busy minute of the day.
Greedy & Intervalsintervalsmerge-intervalsstring-parsingsorting - Trees & GraphsMediumAuto-gradedService Inventory Filter and Dependency Risk Report
Filter a service inventory by namespace, attributes and status, then compute transitive dependencies and risk flags from a root service, handling cycles and dangling references.
Trees & Graphsgraph-traversaldfshash-mapfiltering - StringsMediumAuto-gradedFewest Source Slices to Spell a Target
Find the minimum number of source substrings whose concatenation equals the target, using longest-match-per-position and a greedy jump pass.
Stringsstringsgreedysuffix-automatontwo-pointers - Trees & GraphsMediumAuto-gradedShortest Route to an Exit with Fixed Direction Priority
Run BFS on a character grid to return the shortest move sequence to any exit, breaking ties by a fixed U, D, L, R direction priority.
Trees & Graphsbfsgridshortest-pathpath-reconstruction - Math & Bit ManipulationEasyAuto-gradedLamps After Divisor Sweeps
Count how many of n switches end up on after sweeping by every step size, which tests the divisor-parity and perfect-square insight.
Math & Bit Manipulationmathnumber-theoryperfect-squaresdivisors - Dynamic ProgrammingMediumAuto-gradedCounting Valid Ordered Binary Trees on n Labeled Nodes
Count the distinct binary search trees on keys 1..n by splitting on the root and combining independent subtree counts with dynamic programming.
Dynamic Programmingdynamic-programmingcombinatoricsbinary-search-treecatalan-numbers - Math & Bit ManipulationHardAuto-gradedCan a Starting Pair Grow Into a Goal Pair by Summing Coordinates?
Decide whether a goal pair is reachable from a start pair by replacing one coordinate with the sum of both, using a reverse walk with Euclid-style modulo jumps for values up to 10^9.
Math & Bit Manipulationmatheuclidean-algorithmreverse-thinkingmodulo - Stacks & QueuesMediumAuto-gradedRebuild an Outline Tree from Depth-Tagged Lines
Turn a flat sequence of (depth, label) entries into a nested tree by attaching each entry to its nearest earlier entry with a smaller depth, using a monotonic stack.
Stacks & Queuesstacktree-constructionparsingmonotonic-stack - Math & Bit ManipulationHardAuto-gradedFewest Presses to Morph One Light Grid Into Another
Find the smallest set of cell presses that turns one on/off grid into another, where each press flips a cell and its neighbours. Tests GF(2) elimination and null-space minimisation.
Math & Bit Manipulationgaussian-eliminationgf2bitmasklinear-algebra - Arrays & HashingEasyAuto-gradedFilter Events per Subscriber with Named Rules
Apply an ordered list of named filter rules to every user-event pair and build a per-user list of qualifying event ids, handling missing prices, empty rule lists and unknown rule names.
Arrays & Hashinghash-mapsimulationfilteringstrategy-pattern - Arrays & HashingEasyAuto-gradedLeftmost Column Containing a One in Row-Sorted Grid
Find the leftmost column holding a 1 in a binary grid whose rows are sorted, aiming for a linear-time walk instead of scanning every cell.
Arrays & Hashingmatrixtwo-pointersbinary-matrixstaircase-search - Arrays & HashingMediumAuto-gradedWeekly Power-User Share per Country from Impression Logs
Group impression records by country and user over a 7-day window, flag users with 4+ active dates and 3+ surfaces on one date, and report per-country percentages.
Arrays & Hashinghash-mapgroupingsetsdate-handling - Trees & GraphsMediumAuto-gradedBest Island Total with Row-Major Boundary Cells
Find connected components in a signed grid and pick the best-scoring one, with and without a no-negatives rule, reporting its first and last row-major cells.
Trees & Graphsgriddfsconnected-componentstie-breaking - Data Structure DesignMediumAuto-gradedLive Ranking Board for Sponsored Listings
Process a batch of insert, delete and top-k operations on scored items, keeping a live ranking with in-place score updates and deterministic tie-breaking.
Data Structure Designheaphash-maplazy-deletiondesign - Data Structure DesignEasyAuto-gradedLedger Replay: Deposits, Withdrawals and Percentage Rewards
Simulate a single account balance across a sequence of operations, silently rejecting invalid ones, and report the balance after each step.
Data Structure Designsimulationstate-managementvalidationfloating-point