Coding interview problems by topic
150 original problems in 15 topics. Every expected answer comes from running a reference solution, checked against a second solution and a brute force. Read a topic's guide, then practice a problem with an AI interviewer that asks follow-ups and scores you.
Arrays & Hashing
Read the Arrays & Hashing guide →Learn hash-map lookups, frequency counting, prefix-state hashing, and canonical keys for efficient array algorithms.
- Two SumIndices of two array elements whose sum equals a targetEasy
- Retained Probe DirectivesIndices of each integer's last occurrence in an array, in increasing orderEasy
- Bakery Counter DecisionsMark which ordered value requests can consume matching array elementsEasy
- Balanced Weather AuditIndices of the longest subarray with equal counts of -1, 0, and 1Medium
- One Locked ArenaLongest interval with endpoints in an array and at most one missing integerMedium
- Uncalibrated Shelf ScansGroup indices of arrays equivalent under uniform shifts and reversalMedium
- Feed Batch BoundariesEnd indices of the most contiguous blocks reorderable to match a target arrayMedium
- Single-Mutation Control PartnersFor each string, smallest index of one differing at exactly one positionMedium
- Festival Bookend BlocksCount subarrays with equal ends and specified distinct count and max frequencyHard
- Archived Lift ItinerariesCount distinct array subsequences of length ≥2 per prefix obeying directed edgesHard
Sliding Window
Read the Sliding Window guide →Learn fixed and variable sliding windows, frequency tracking, minimum-cover windows, and monotonic deques, with Python templates and complexity.
- Preview Download BudgetEarliest start index of k consecutive array elements with minimum sumEasy
- League Review StretchIndices of the earliest longest subarray with sum at most a budgetEasy
- Ward Handoff ReviewStart indices of length-k subarrays with at most max_changes adjacent changesEasy
- Longest Substring Without Repeating CharactersLength of the longest substring with no repeated charactersMedium
- Chess Club Review ReelEndpoints of the shortest subarray meeting all per-value quotasMedium
- Steady Departure StretchEarliest longest subarray indices with max-min within a given boundMedium
- Orbital Echo ArchiveIndices of the earliest longest subarray with at most k equal-value pairsMedium
- Bakery Relabeling StretchLongest subarray made constant within a per-element change-cost budgetMedium
- Weather Trace RetuningEndpoints of the longest subarray equalizable within an absolute-change budgetHard
- Arena Rating RampFarthest end per start for array intervals made nondecreasing by budgeted raisesHard
Learn stack fundamentals, bracket matching, undo and redo, collision simulation, monotonic stacks, and greedy subsequence construction.
- Valid ParenthesesDetermine whether a parentheses string is well-formedEasy
- Shelf Brace AnchorsIndex of the nearest strictly greater value to the left of each array elementEasy
- Carousel Draft RecoveryFinal array from integer commands that append, undo, or redoEasy
- Culture Tray Clearance RoundsRemoval round for each array element smaller than its current left neighborMedium
- Production House Spotlight OrderLexicographically smallest array subsequence with each distinct string onceMedium
- Grooming Strip SelectionSubarray indices maximizing minimum value times sum of paired weightsMedium
- Recount Seal ArbitrationOriginal indices surviving magnitude-based conflicts in a signed integer arrayMedium
- Solar Mast SightlinesCount array pairs with no intervening value above the smaller endpointMedium
- Marathon Recovery LedgerSum of each subarray's minimum times its sum, modulo 1,000,000,007Hard
- Box Office Remittance BundlesMinimum sum of maxima when partitioning an array into k contiguous groupsHard
Intervals
Read the Intervals guide →Learn interval merging, intersection, subtraction, endpoint sweeps, resource allocation, and heap-based scheduling and containment queries.
- Shared Warming Drawer RangeIntersection of closed integer intervals and a given intervalEasy
- Museum Access Slot TrimmingRemaining fragments after removing one interval from disjoint intervalsEasy
- Single-Driver Turnaround CheckCheck whether intervals are nonoverlapping with a required gapEasy
- Merge IntervalsMerge overlapping intervals into a condensed listMedium
- Solo Stream ExposureDuration each interval is active without overlap from other intervalsMedium
- League Replay Channel RosterAssign smallest available IDs to intervals in start-time and index orderMedium
- Ward Monitor Reservation CutsMinimum intervals to remove so overlap never exceeds a given capacityMedium
- Chess Club Drop-In GuideIndices of shortest intervals covering query times, ties by lowest indexMedium
- Two Bus Runs Off the BoardIndices of two intervals whose removal minimizes remaining union lengthHard
- Orbital Relay Coverage BudgetMinimum total cost of intervals covering zero to each target without gapsHard
Learn tree traversal, path tracking, subtree dynamic programming, and rerooting, with Python patterns and time and space analysis.
- Election Rollup AuditCheck if binary tree non-leaf values equal their subtree leaf sumsEasy
- Solar Branch CalibrationMinimum root-to-leaf path sum in a binary treeEasy
- Marathon Uphill EndpointsBinary tree leaf values on strictly increasing root-to-leaf paths, left to rightEasy
- Binary Tree Level Order TraversalNode values of a binary tree grouped by level, from left to rightMedium
- Box Office Override StaffingMaximum sum of binary tree node values with at most one adjacent chosen pairMedium
- Airport Transfer Burden MapSum of value-weighted distances for each binary tree node in preorderMedium
- Wildlife Corridor BoundaryMaximum nodes on a binary tree path with at most one value changeMedium
- Exchange Relay InspectionMinimum walk length from a binary tree's root visiting all nodes valued 1Medium
- Recipe Reminder StationsMinimum cost to cover every tree node using radius-two node coverageHard
- Museum Isolation WingMinimum vertex and boundary-edge cost for k connected nodes in a treeHard
Two Pointers
Read the Two Pointers guide →Learn opposing, merging, and same-direction two-pointer patterns, with Python templates, correctness reasoning, and complexity analysis.
- Recount Disagreement SlipsSorted unmatched elements after canceling equal pairs across two arraysEasy
- Solar Row Symmetry CheckWhether an integer array is a palindrome after at most one deletionEasy
- Marathon Timing Review OrderIndices of a sorted array ordered by absolute value, then indexEasy
- Three-Slip Settlement BatchesCount triples of distinct array indices with sums in an inclusive rangeMedium
- Two-Flight Crew RostersMaximum disjoint index pairs with a minimum value gap in a sorted arrayMedium
- Eastbound Survey CleanupIndices of the shortest subarray to remove to make an array nondecreasingMedium
- Withdrawal Tape AgreementWhether two arrays yield equal sequences after appends and deletionsMedium
- Glaze Channel PortionsTrapped volume at each index from height and width arraysMedium
- Museum Zone Boundary AtlasValid second-cut ranges per first cut for constrained three-part array splitsHard
- Ranked Curbside RendezvousKth smallest cross-label meeting score from position and ready-time arraysHard
Linked List
Read the Linked List guide →Learn linked-list traversal, pointer rewiring, reversal, fast and slow pointers, stable partitioning, and merge sort with Python examples.
- Bus Stop Echo TrimmingKeep only the first and last nodes of each equal-value linked list runEasy
- Probe Packet Fast LaneReorder a linked list with values at least a cutoff first, keeping group orderEasy
- Bakery Tray Pair ChecksReorder original adjacent pairs in a linked list smaller-value firstEasy
- Calibration Review ChainOrder linked list nodes by distance to a target, keeping ties in input orderMedium
- Checkpoint Lobby WeaveReorder each nonzero linked-list block by alternating front and back nodesMedium
- Library Ledger VoidsLinked list after repeatedly removing earliest-start, longest zero-sum blocksMedium
- Community Credit Carry LedgerNormalize linked-list digits in a given base while preserving their valueMedium
- Genetic Signal Ring ShiftsRotate each nonzero linked-list block right by its value sumMedium
- Festival Reel Run DispatchReorder a linked list by repeatedly extracting longest strictly increasing runsHard
- Ski Patrol Chain ExchangesFinal linked list after segment exchanges and undo operationsHard
Binary Search
Read the Binary Search guide →Learn binary search invariants, lower and upper bounds, monotone feasibility checks, ranked selection, and common implementation mistakes.
- Transfer Desk Flight PicksFirst index in a sorted array with value at least each query plus an offsetEasy
- Unlogged Wildlife TagsKth missing positive integer from a strictly increasing arrayEasy
- Opening Bell BatchLargest equal-length prefixes with one array's minimum ≥ the other's maximumEasy
- Anchored Spice FlightMaximum minimum pairwise gap among k array elements with a required indexMedium
- Museum Conservation ChambersMinimize max sum-plus-max cost over at most k contiguous paired-array groupsMedium
- Curbside Dispatch RadiusMinimum maximum absolute difference for one-to-one matching of two arraysMedium
- Preview Cue LedgerKth entry across arithmetic sequences ordered by value and source indexMedium
- League Training BoostsMinimum days to meet array targets with uniform gains and one bonus per dayMedium
- Ward Support PassesMaximum matches between requirement and capacity arrays with limited boostsHard
- Chess Club Ledger SessionsMinimum peak sum of k contiguous array parts, with lexicographically first cutsHard
Learn trie insertion, prefix matching, subtree counts, string segmentation, and binary tries for maximum-XOR and rank queries.
- Pickup Zone Prefix RoutingLongest prefix of each string found in a given list of stringsEasy
- Track Search BadgesShortest distinguishing prefix for each string in an arrayEasy
- League Radio Code CheckCheck that no string in a list is a prefix of anotherEasy
- Ward Scanner Cut MarksString cuts minimizing dictionary costs, piece count, then lexicographic orderMedium
- Chess Study Contrast PartnersEarliest prior indices maximizing XOR within a given array index distanceMedium
- Bus Itinerary Tail RepairsEarliest archive index minimizing end deletions and appends per query stringMedium
- Telemetry Alarm TalliesFor each array value, count earlier values with XOR in a given rangeMedium
- Bakery Ranked Label OrdersSelect and remove lexicographically ranked strings matching each prefixMedium
- Weather Mast Calibration LinksMinimum total cost to connect array elements with XOR-weighted edgesHard
- Arena Console ExpeditionFewest appends and end deletions to match k distinct input stringsHard
Learn min-heaps and max-heaps, priority updates, top-k selection, multiway merging, and greedy algorithms with Python examples.
- Library Repair Desk RoutingIndices assigned to array durations by lowest load, then lowest indexEasy
- Spotlight Cooldown ScoresFinal array after repeatedly halving the leftmost maximum, rounded downEasy
- Read Bundle Assembly BudgetMinimum total cost to merge array elements, costing each pair's sumEasy
- Festival Preview BoothStart times from duration and priority arrays under arrival and expiry rulesMedium
- Snow Survey Synchronization BandNarrowest integer interval meeting each sorted array's count quotaMedium
- Correction Night LeadersSmallest index of a maximum array value after each additive updateMedium
- Solar Cleaning Voucher SelectionLexicographically smallest maximum-value indices from value and deadline arraysMedium
- Marathon Gel StopsFewest resource additions to reach a target from position and amount arraysMedium
- Box Office Paired Seat ReserveMinimum total gap for k disjoint adjacent pairs in an increasing arrayHard
- Ranked Flight Withdrawal LedgerKth smallest subset sum of an integer array, counting duplicatesHard
Backtracking
Read the Backtracking guide →Learn backtracking for subsets, permutations, partitions, and constrained search, with pruning, state restoration, and complexity analysis.
- Quiet Camera LayoutsAll nonadjacent k-index subsets of 0 to n-1 in lexicographic orderEasy
- Exchange Inventory RehearsalsAll fixed-length strings with bounded running balance and a given final balanceEasy
- Recipe Tasting RoutesLexicographically ordered index permutations with unequal adjacent array valuesEasy
- Balanced Artifact TraysWhether an array can form k groups of equal size and equal sumMedium
- Shared Ride Stop PlannerLexicographically smallest permutation with interval, order, and capacity limitsMedium
- Mirrored Cue SessionsAll string splits into k palindromic substrings, as exclusive end indicesMedium
- Exhibition Opponent CardsAll perfect matchings within a cost budget in a weighted graphMedium
- Ward Swab Reading RouteLexicographically smallest grid path spelling a string with exactly k turnsMedium
- Chess Club Spotlight BudgetMinimum-cost usable cells, one per grid row, with no column or diagonal conflictsHard
- Bus Depot Inspection RunsIndices of minimum-cost subsets covering every element exactly onceHard
Graphs
Read the Graphs guide →Learn graph representations, BFS, DFS, shortest paths, topological sorting, union-find, and spanning trees for coding interviews.
- Emergency Beacons for Orbital OutpostsSmallest node in each undirected graph component with no active nodeEasy
- Bakery Chute Transfer MapFewest edges from a start node to every node in a directed graphEasy
- Weather Relay Band CheckCheck whether graph nodes can be split into two edge-free groupsEasy
- Checkpoint Certainty MapNodes where every path eventually reaches a target in a directed graphMedium
- Library Courtesy Door RouteLexicographically smallest shortest graph path using at most one marked edgeMedium
- Friendship Exit SnapshotsComponent sizes of specified nodes after successive graph edge deletionsMedium
- Strain Calibration DestinationsMinimum cost and lowest-index nearest target per directed graph nodeMedium
- Festival Screening Flex WindowsStart-time slack per node in a minimum-duration dependency graph scheduleMedium
- Ski Lodge Closure ImpactCount newly disconnected node pairs after each node removal in a graphHard
- Recount Cable CommitmentsClassify edges across all minimum-cost spanning trees of a weighted graphHard
Dynamic Programming
Read the Dynamic Programming guide →Learn dynamic programming through memoization, sequence states, knapsack, interval and subset DP, with clear transitions and complexity analysis.
- Solar Inverter Day PlanMinimum cost from a two-column array with penalties for changing columnsEasy
- Marathon Supply Crate BudgetMinimum cost to cover an array using given single and adjacent-pair costsEasy
- Box Office Campaign ForecastsMaximum contiguous subarray sum, or zero, for each array prefixEasy
- One Express TurnaroundMaximum interval weight with required gaps and one reduced gap allowedMedium
- Wildlife Survey Time FrontierMax value per exact total weight from arrays, at most one item per groupMedium
- Exchange Rehearsal Profit LadderMaximum profit for each exact transaction count from a price array and feeMedium
- Recipe Portion CounterMinimum count of array values with repetition summing to a targetMedium
- Museum Climate Dial SchedulesCount integer sequences in intervals by final value with bounded changesMedium
- Pooled Pickup Release CreditsMaximum score from removing uniform array blocks with weighted squared lengthsHard
- Crossfade Rehearsal OrdersMinimum cost and optimal permutation count given a matrix and precedenceHard
2-D Dynamic Programming
Read the 2-D Dynamic Programming guide →Learn 2-D dynamic programming through grid paths, sequence alignment, and interval states, with transitions, reconstruction, and complexity.
- League Warm-Up SquaresLargest side length of an all-1 square in a binary matrixEasy
- Ward Quiet Access MapMinimum peak value on right/down grid paths from top-left to each cellEasy
- Chess Club Forward Knight AtlasPath counts from top-left to each open grid cell via (1,2) or (2,1) movesEasy
- Bus Log Replay PlansMinimum cost and count of optimal ways to consume two arrays in orderMedium
- Probe Echo Trimming LedgerMinimum deletion cost to make each integer array prefix palindromicMedium
- Bakery Pickup Tray AlignmentLexicographically smallest minimum-cost ordered matching of two arraysMedium
- Weather Archive Gap FeesMinimum cost to pair or discard elements of two ordered arraysMedium
- Arena Relic Draft DuelOptimal score difference as players take 1–2 values from either array endMedium
- Shared Catalog Spine CodesCount distinct longest common subsequences of two strings by first letterHard
- Mirrored Reaction BadgesCount distinct nonempty palindromic subsequences of a string by length parityHard
Greedy
Read the Greedy guide →Learn when greedy algorithms work, how to prove local choices, and the main sorting, interval, construction, and heap-based patterns.
- Assay Ladder RetuningMinimally increased array with each value at least a given gap above the priorEasy
- Festival Calibration MomentsLexicographically largest shortest integer list hitting all intervalsEasy
- Ski Trail Opening ChecklistMax-count array subset indices within budget, least sum then lexicographic orderEasy
- Two-Desk Ballot Batch PipelineMinimum completion time for an array of two-stage processing timesMedium
- Solar Brush DispatchLexicographically smallest optimal fixed-width interval counts for array demandsMedium
- Marathon Recovery CircuitMinimum initial value for a feasible order of requirement-change pairsMedium
- Box Office Refund QueueLexicographically first array index order minimizing weighted completion costMedium
- Flight Packet Deadline DeskMaximum tasks completed by deadlines from duration-deadline pairsMedium
- Wildlife Capture CommitmentsMinimum number of integer points meeting each interval's required countHard
- Exchange Quote StaircaseLexicographically first nondecreasing array minimizing weighted absolute errorHard
Practice them in a real interview setting
Talk through your approach, run your code against hidden tests, and get a scored debrief.
Open the library in the app