practice a little every day — you've got this ♡
Coding Interview Problems
Practice 6046 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.
- 6046
- Problems
- 2239
- Auto-graded
- 15
- Topics
- 273
- Added today
Showing 1321–1350 of 2792 results
- Trees & GraphsMediumAuto-gradedLongest Dependency Chain in a Task DAG
Find the longest total-duration chain in a task dependency DAG and return its length and task names, using topological-order DP with predecessor tracking.
Trees & Graphsgraphdagtopological-sortdynamic-programming - Trees & GraphsMediumAuto-gradedAcyclic Invitation Graph with Depth Queries and Expected Payout
Simulate a stream of operations on a DAG: reject cycle-forming or duplicate edges, count nodes within a hop limit, and sum expected decayed payouts using BFS shortest distances.
Trees & Graphsgraphbfsdagcycle-detection - StringsMediumAuto-gradedDecode a Hex String into a Dotted-Quad Network Address
Validate a strict 8-digit hex string with an optional 0x prefix and convert it into dotted-decimal IPv4 form, treating the leftmost byte as the first octet.
Stringsstringsparsingvalidationhexadecimal - Heaps, Sorting & SearchMediumAuto-gradedRunning Median Over a Command Log of Inserts and Queries
Process a log of insert and query commands on a growing multiset of integers, reporting the median at each query using two heaps for efficient updates.
Heaps, Sorting & Searchheaptwo-heapsstreamingmedian - Stacks & QueuesMediumAuto-gradedSelf-Time Accounting for Nested Call Traces
Use a stack to turn start/end trace records of nested calls on one CPU into each function's self-time, with inclusive end timestamps.
Stacks & Queuesstackparsingsimulationstrings - Arrays & HashingMediumModel answerCart Pricing Engine: Offers, Cheapest Deal, Aisle Sort
Parse cart records, total units and price in integer cents, apply the best percent-off or buy-N-get-M-free deal per product, then sort items by aisle with frozen goods at the end.
Arrays & Hashingparsingmoney-arithmeticextensible-designsorting - Data Structure DesignMediumAuto-gradedReplay Operations on a Skip-Ahead Iterator
Simulate a forward-only iterator that yields every k-th element, with an idempotent has-next check, and return the results of a scripted sequence of operations.
Data Structure Designiteratorsimulationstate-managementdesign - Heaps, Sorting & SearchEasyAuto-gradedRank Advertisers by Reports, Then Report Rate
Aggregate per-ad records by advertiser, then rank with a multi-key sort (total reports, report rate, id) and return the top k.
Heaps, Sorting & Searchhashingsortingaggregationcustom-sort-key - Dynamic ProgrammingMediumAuto-gradedMaximum Ore Haul on a Climb-and-Step Grid Route
Grid dynamic programming: find the route with the largest sum from the bottom-left to the top-right cell when only moving up or right.
Dynamic Programmingdynamic-programminggridmatrixpath-sum - Greedy & IntervalsMediumAuto-gradedFewest Vehicles to Cover Back-to-Back Bookings
Find the peak number of simultaneously active half-open intervals using a sweep line or heap, with correct handling of ties where one booking ends as another begins.
Greedy & Intervalsintervalssweep-linesortingheap - Data Structure DesignMediumAuto-gradedParcel Runner Payout Ledger with Peak Overlap Queries
Simulate a stateful ledger driven by operation lists: track per-runner payout sums and compute maximum simultaneous half-open intervals clipped to a query window.
Data Structure Designsweep-linehash-mapintervalssimulation - Data Structure DesignMediumAuto-gradedBatch Runner for a Slash-Separated Key Store
Simulate a hierarchical key store from a batch of create/get commands, where a key can only be created once its parent key already exists.
Data Structure Designdesignhash-maptriesimulation - Trees & GraphsEasyModel answerLone-Parity Filter and Leftmost Node Per Tree Depth
Write one function that returns the elements whose even/odd class appears exactly once in an array, plus the first node's value at every depth of a binary tree.
Trees & Graphsbfsbinary-treelevel-ordercounting - Trees & GraphsMediumAuto-gradedJob Scheduling with Cycle Check and Downstream Rerun Set
Topologically sort jobs with cycle detection, then use graph reachability to find all jobs affected by changed ones and list them in valid order.
Trees & Graphstopological-sortgraphbfscycle-detection - Greedy & IntervalsMediumAuto-gradedSequential Allow/Deny Rules Over an IPv4 Block
Track an IPv4 block as disjoint integer intervals while applying ordered allow and deny CIDR rules, deciding whether the block ends up fully covered with no deny hit.
Greedy & Intervalsintervalsipv4cidrsimulation - Data Structure DesignMediumAuto-gradedHealthy Region Registry and Nearest-Site Router
Simulate a command interpreter that registers sites, toggles their health, and answers nearest-healthy-site queries by great-circle distance, with strict validation and tie-breaking.
Data Structure Designsimulationstring-parsinghash-mapvalidation - Arrays & HashingEasyAuto-gradedYearly Account Balance with Conditional Monthly Service Charges
Simulate a year of account activity, applying a flat monthly charge unless a month has enough payments with a large enough total, and return the final balance.
Arrays & Hashingsimulationhash-mapaggregationconditional-logic - Greedy & IntervalsMediumAuto-gradedCourier Earnings from Overlapping Order Events
Sweep over unsorted start/end events to total concurrency-weighted seconds, validate malformed input, and convert to a half-up rounded dollar string.
Greedy & Intervalsinterval sweepevent sortingvalidationexact arithmetic - Data Structure DesignEasyAuto-gradedMost Likely Follower Lookup Over Streaming Sentences
Process a stream of add and query operations over sentences, tracking adjacent-word counts and returning the most frequent follower with lexicographic tie-breaking.
Data Structure Designhash-mapstringssimulationcounting - StringsEasyAuto-gradedReport SQL Clauses in Conceptual Evaluation Order
Detect which of six SQL clauses appear in a query string and return them in SQL-92 logical evaluation order, using case-insensitive whole-word matching.
Stringsstringsregexsqlparsing - StringsMediumAuto-gradedMask the Leftmost Longest Keyword in a Text
Find the earliest-starting match among several keywords, prefer the longest at that spot, and collapse it into a single placeholder character.
Stringsstringsstring-matchingsimulationtrie - StringsHardModel answerChunk-Safe Tokenizer for Fenced Code Blocks
Design a stateful tokenizer that turns arbitrarily chunked Markdown into text and code-block events, correctly handling fences split across chunk boundaries.
Stringsstreamingstate-machinestring-parsingmarkdown - Heaps, Sorting & SearchMediumAuto-gradedReplay Commands to Track a Running Median
Replay a list of insert and query commands on a growing multiset of integers, reporting the median at each query; tests two-heap or order-statistic maintenance.
Heaps, Sorting & Searchheapstreamingmediandesign - Data Structure DesignMediumModel answerFrequency-Ranked Shuffle Without Repeats Per Round
Build a player that ingests users' song lists and serves songs from most to least popular, never repeating a song until every known song has played once in the round.
Data Structure Designheaplazy-deletionhash-mapdesign - Data Structure DesignMediumAuto-gradedWeighted Prefix Suggestion Engine via Command Replay
Replay a list of add and search commands on a weighted word store, returning the top-k prefix matches ranked by weight, then alphabetically.
Data Structure Designtrieprefix-searchheaphash-map - Math & Bit ManipulationMediumAuto-gradedChance of a Red Majority When Skipping Returned Marbles
Compute a probability for a draw process with discarded-and-returned items by reducing it to a hypergeometric count, ignoring the irrelevant returned category.
Math & Bit Manipulationprobabilitycombinatoricshypergeometricmath - Trees & GraphsHardAuto-gradedFewest Rounds to Slay a Scripted Boss With One Revive
Find the minimum number of rounds to defeat a boss that attacks on a repeating script, using state-space BFS over boss HP, player HP, revive flag, and script position.
Trees & Graphsbfsstate-space-searchsimulationshortest-path - Data Structure DesignMediumAuto-gradedReplay a Log on a Budgeted Recency Cache
Simulate a least-recently-used cache whose budget is the sum of per-entry sizes, replaying an operation log and returning each result, using hashing plus recency ordering.
Data Structure Designlru-cacheordered-dicthash-mapsimulation - Trees & GraphsMediumAuto-gradedList Every Non-Repeating Route in a Directed Graph
Enumerate all routes from a source to a target in a directed graph that never revisit a node, returned in lexicographic order, using backtracking DFS.
Trees & Graphsgraphdfsbacktrackingrecursion - Trees & GraphsMediumAuto-gradedLeft-Packed Tree Check from a Level-Order Array
Decide whether a binary tree given as a level-order array with None placeholders is complete, by rebuilding it and scanning breadth-first for a node that follows a gap.
Trees & Graphsbinary-treebfslevel-ordertree-construction