practice a little every day — you've got this ♡
Interview Practice Problems
Practice 6025 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.
- 6025
- Problems
- 2231
- Auto-graded
- 15
- Topics
- 273
- Added today
Showing 931–960 of 2231 results
- Trees & GraphsHardAuto-gradedCalculate Subtree Totals in a Tree
Given an undirected tree and node weights, compute the sum of values for every subtree rooted at node 1.
Trees & Graphstrees-graphsdfstree-traversalbottom-up - Math & Bit ManipulationMediumAuto-gradedChance a Daily +/- Walk Ends Below Zero
Model a price as a two-step random walk, reduce it to a binomial lower tail with a strict cutoff, and sum that tail in a numerically stable way.
Math & Bit Manipulationprobabilitybinomialnumerical-stabilityrandom-walk - Trees & GraphsEasyAuto-gradedExtract Sorted Values from Level-Order Encoded BST
Extract all valid integer elements from a level-order serialized binary search tree and return them in non-decreasing order.
Trees & Graphstrees-graphsheaps-sortingbinary-search-tree - Trees & GraphsMediumAuto-gradedBest Net Reward Route to an Underscore Node in a DAG
Find the highest net score of a route in a weighted DAG that ends at a node whose name starts with an underscore, using topological order and DP.
Trees & Graphsgraphdagtopological-sortdynamic-programming - Data Structure DesignMediumAuto-gradedIdentify Winning Move in Bottom-Inserted Drop Game
Simulate a custom grid game with bottom-insertion pushes to detect the earliest turn that forms a line of length k.
Data Structure Designarrayshash-tablesimulationdesign-ds - Arrays & HashingEasyAuto-gradedReverse Array Segment Between First Two Target Occurrences
Reverse the subsegment of an array from the first occurrence of a target value up to its second occurrence.
Arrays & Hashingarraystwo-pointersslicing - Math & Bit ManipulationEasyAuto-gradedCalculate Expected Score from Multi-Stage Die Rerolls
Computes the optimal decision threshold and overall expected payoff when given one optional reroll on an N-sided die.
Math & Bit Manipulationmathprobabilityexpected-valuedynamic-programming - Math & Bit ManipulationEasyAuto-gradedDetermine Animal Quantities in a Barn
Find the integer count of each animal species given the total legs and proportional species constraints.
Math & Bit Manipulationmathalgebra - Stacks & QueuesMediumAuto-gradedRounds of Pruning in a Garden Row
Count how many rounds of simultaneous removals occur in a row of numbers where each element larger than its left neighbor is removed, using a monotonic stack to beat quadratic simulation.
Stacks & Queuesmonotonic-stacksimulationarraysamortized-analysis - Math & Bit ManipulationMediumAuto-gradedMaximize Disjoint Letter Coverage
Find the maximum count of distinct letters that can be collected by picking a mutually disjoint subset of strings.
Math & Bit Manipulationbit-manipulationbacktrackingdynamic-programmingstrings - Trees & GraphsMediumAuto-gradedCommon Ancestor of Two Values, Only If Both Exist
Find the lowest common ancestor of two values in a level-order encoded binary tree, returning null when either value is missing from the tree.
Trees & Graphsbinary-treelowest-common-ancestorparent-mapbfs - Trees & GraphsMediumAuto-gradedMaximum Subtree Weight for Every Node in a Network
Find the maximum sum of a connected component containing each node in an undirected tree using dynamic programming with rerooting.
Trees & Graphstrees-graphsdynamic-programmingtree-dprerooting-dp - Arrays & HashingMediumAuto-gradedRunners on a Road Frozen by a Sweeping Guard
Simulate runners advancing along a road while a guard turns at given seconds and freezes anyone in view, using parity of duplicate turn times and strict event ordering.
Arrays & Hashingsimulationhash-mapcountingparity - Stacks & QueuesMediumAuto-gradedWidest Span Between Two Dominating Ends
Find the longest subarray whose two end values are each strictly larger than everything between them, using a monotonic stack to avoid checking all pairs.
Stacks & Queuesmonotonic-stackarraysnearest-greateramortized-analysis - StringsEasyAuto-gradedFill In Percent-Delimited Tokens From a Lookup Table
Scan a string left to right, replacing each %key% token with its mapped value and returning None when a key is missing; tests careful linear string parsing.
Stringsstringsparsinghash-maptwo-pointers - Greedy & IntervalsMediumAuto-gradedInsert and Merge Interval into Sorted Collection
Incorporate a target range into an already sorted list of disjoint closed intervals, merging any overlapping or adjacent spans in linear time.
Greedy & Intervalsintervalsarraysgreedy - Data Structure DesignMediumAuto-gradedReplay a Bounded Recency Store from an Operation Log
Simulate a fixed-size store that discards its stalest entry on overflow, answering lookups in O(1) each by pairing a hash map with a doubly linked list.
Data Structure Designhash-mapdoubly-linked-listlru-cachesimulation - Heaps, Sorting & SearchMediumAuto-gradedWhere Is the Traveler? Locate by Timestamp from Trip Logs
Answer timestamp queries against unsorted trip intervals using sorting and binary search, handling closed boundaries, gaps between trips, and times before the first trip.
Heaps, Sorting & Searchbinary-searchsortingintervalssimulation - Arrays & HashingEasyAuto-gradedPush Zeros Left While Keeping Other Values in Order
Rearrange an integer list in place so all zeros come first and the non-zero values keep their original relative order, using a right-to-left two-pointer pass.
Arrays & Hashingarraystwo-pointersin-place - Arrays & HashingMediumAuto-gradedFour-Position Target Sum Finder Preserving Original Indices
Find all increasing index quadruples whose values add up to a target, treating equal values at different positions as distinct answers; tests hashing pair sums and ordering.
Arrays & Hashinghash-mapmeet-in-the-middlek-sumindices - Math & Bit ManipulationEasyAuto-gradedSimulate Account Transactions with Integer Cashbacks
Process a series of deposits, conditional withdrawals, and integer floor cashbacks to compute a final account balance.
Math & Bit Manipulationsimulationmatharrays - Trees & GraphsMediumAuto-gradedReferral Credit Ledger with Multilevel Propagation
Simulate account additions, referral bonus propagation (direct or indirect), and threshold queries ordered deterministically.
Trees & Graphstrees-graphsarraysdesign-ds - Trees & GraphsMediumAuto-gradedBFS Unweighted Shortest Path with Ancestor Tracking
Perform breadth-first traversal on an unweighted graph to compute shortest distances and record parent pointers for path reconstruction.
Trees & Graphsbfsgraph-traversalshortest-pathqueue - Trees & GraphsMediumAuto-gradedLightest Downward Path in a Level-Order Tree
Find the root-to-leaf path with the smallest value sum in a tree given as a level-order list, breaking ties toward the left, without recursion on 100,000-node skewed trees.
Trees & Graphsbinary-treedfsiterative-traversalprefix-sum - Heaps, Sorting & SearchMediumAuto-gradedSelect the k Most Common Values with Tie Rules
Count value frequencies and pick the k most frequent values, using a bounded heap and a defined tie-break rule for equal counts.
Heaps, Sorting & Searchheaphash-mapfrequency-countingtop-k - Heaps, Sorting & SearchEasyAuto-gradedAdjacent Entries Lookup in a Sorted Catalog
Answer batched queries on a sorted list of unique IDs by binary searching for each target and returning its adjacent values, or nulls when the target is absent.
Heaps, Sorting & Searchbinary-searchsorted-arraybisectbatch-queries - Heaps, Sorting & SearchEasyAuto-gradedLocate Gap in Sorted Consecutive Sequence
Detect a missing entry in a sorted contiguous array of integers in logarithmic time using binary search.
Heaps, Sorting & Searcharraysbinary-search - Greedy & IntervalsMediumAuto-gradedFind the Maximum Size Connected Interval Component
Find the maximum number of intervals that belong to a single connected component where edges represent inclusive interval overlaps.
Greedy & Intervalsintervalssortinggreedygraphs - Greedy & IntervalsEasyAuto-gradedSplit Chores Between Two Workers With a Fixed Quota
Choose exactly k items for the first worker to maximize total payoff, which tests reducing a problem to per-item differences and greedy top-k selection.
Greedy & Intervalsgreedysortingarraysexchange-argument - Arrays & HashingEasyAuto-gradedSoftmax-Weighted Value Mixing for Query Rows
Implement scaled dot-product attention on nested lists using a numerically stable softmax and a weighted average of value rows.
Arrays & Hashingmatrixsoftmaxnumerical-stabilityattention