practice a little every day — you've got this ♡
Heaps, Sorting & Search Interview Problems
Practice 5971 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.
- 5971
- Problems
- 2211
- Auto-graded
- 15
- Topics
- 272
- Added today
Showing 121–150 of 200 results
- Heaps, Sorting & SearchMediumAuto-gradedExpiring Compute Credits: Offline Ledger Replay
Replay a shuffled log of credit grants, spends and balance queries in time order, spending the soonest-expiring credits first, using a heap and sorting.
Heaps, Sorting & Searchheapsortingsimulationoffline-processing - Heaps, Sorting & SearchMediumAuto-gradedMedian Tracker for an Incoming Number Feed
Maintain the median of a growing sequence after each new value arrives, testing efficient order-statistic upkeep with a pair of heaps.
Heaps, Sorting & Searchheaptwo-heapsstreamingmedian - Heaps, Sorting & SearchMediumAuto-gradedPick the Element at a Given Rank From the Top
Find the k-th largest value in an unsorted integer list, counting duplicates separately, without necessarily sorting the whole list.
Heaps, Sorting & Searchheapquickselectselectionarrays - Heaps, Sorting & SearchMediumModel answerMinimum-Distance Depot Placement on a Grid with Blocked Cells
Place a depot on a 2D integer grid to minimize total Manhattan distance to all warehouses, avoiding any cell occupied by an obstacle.
Heaps, Sorting & Searchmanhattan-distancemedianpriority-queueprefix-sums - Heaps, Sorting & SearchHardModel answerIdentify Hidden Conflict with Minimal Oracle Queries
Find one conflicting pair among n items using a black-box oracle that tests subsets, minimizing the number of expensive queries.
Heaps, Sorting & Searchbinary-searchoptimizationoracleinformation-theory - Heaps, Sorting & SearchMediumAuto-gradedFind k Nearest Values in Sorted Array
Tests binary search on window positions with careful tie-breaking that prefers smaller values when distances are equal.
Heaps, Sorting & Searchbinary-searchsliding-windowtwo-pointers - Heaps, Sorting & SearchMediumAuto-gradedWeighted Lottery Ticket Assignment
Tests prefix sums and binary search to map ticket numbers into population-weighted ranges efficiently.
Heaps, Sorting & Searchbinary-searchprefix-sumsarrays - Heaps, Sorting & SearchMediumAuto-gradedSorted Sensor Readings: Answer Interval Coverage Queries
Tests binary search on sorted arrays with duplicates to answer multiple inclusive range queries in O(log n) per query.
Heaps, Sorting & Searchbinary-searcharraystwo-pointers - Heaps, Sorting & SearchMediumAuto-gradedFind the K-th Largest Element Without Using a Heap
Tests implementation of quickselect to find the k-th largest value in an unsorted array, treating duplicates as separate elements.
Heaps, Sorting & Searchquickselectpartitioningselection-algorithms - Heaps, Sorting & SearchHardAuto-gradedMinimum Lexicographic Sequence with Precedence Constraints
Find the smallest valid ordering of numbered items when some must precede others, or detect when circular dependencies make ordering impossible.
Heaps, Sorting & Searchtopological-sortgraphheapgreedy - Heaps, Sorting & SearchMediumAuto-gradedMerge Sorted Event Streams with Running Sum
Tests k-way merging of pre-sorted sequences using a min-heap, deterministic tie-breaking by source index, and accumulating a running total across all events.
Heaps, Sorting & Searchheapmergek-way-mergerunning-sum - Heaps, Sorting & SearchMediumAuto-gradedMerge K Sorted Lists to Find Smallest Elements
Tests efficient multi-way merge using a min-heap to extract the k smallest values from multiple sorted arrays without flattening the entire input.
Heaps, Sorting & Searchheapmergesortingoptimization - Heaps, Sorting & SearchHardModel answerRolling Window Median Bounds + Binary Array Tiling
Find the max and min sliding-window medians in O(n log k), then partition a binary array into even uniform segments with minimum flips.
Heaps, Sorting & Searchsliding windowheapdynamic programmingbinary array - Heaps, Sorting & SearchMediumAuto-gradedCollect All Closest Adjacent Value Pairs
Tests sorting and greedy scanning to identify the smallest gap between elements and extract all pairs achieving it.
Heaps, Sorting & Searchsortinggreedyarrays - Heaps, Sorting & SearchMediumAuto-gradedThree-Way Color Partition
Tests the ability to partition an array into three distinct categories using a single-pass, constant-space algorithm.
Heaps, Sorting & Searcharraystwo-pointerssortingpartitioning - Heaps, Sorting & SearchMediumAuto-gradedCollect minimum values with adjacent deletions
Tests simulation using a priority queue with lazy deletion and a linked list to repeatedly remove the smallest remaining element and its current neighbors.
Heaps, Sorting & Searchheaplinked-listsimulationlazy-deletion - Heaps, Sorting & SearchMediumAuto-gradedBinary Search Over Date-Filtered Content Flags
Tests whether a candidate can isolate records by category and then apply binary search to efficiently locate all entries within an inclusive date window.
Heaps, Sorting & Searchbinary-searchsortingdata-manipulation - Heaps, Sorting & SearchMediumAuto-gradedFirst Flagged Build in a Deployment Pipeline
Tests whether a candidate can recognize a monotonic predicate and apply binary search to find the first transition point without comparing version strings.
Heaps, Sorting & Searchbinary-searcharraysmonotonic-predicate - Heaps, Sorting & SearchMediumAuto-gradedFind a Value in a Shifted Sorted Array
Tests whether a candidate can run a single-pass binary search on a sorted array that has been cyclically shifted by an unknown offset.
Heaps, Sorting & Searchbinary-searcharraysdivide-and-conquer - Heaps, Sorting & SearchMediumAuto-gradedK-th Value in a Row-and-Column Sorted Grid
Tests binary search on value space combined with an O(n) staircase count to efficiently locate the k-th smallest element in a doubly sorted matrix.
Heaps, Sorting & Searchbinary-searchmatrixheap - Heaps, Sorting & SearchMediumAuto-gradedSelect Up to Three Books from Distinct Genres
Tests greedy optimization with category constraints, hash-map aggregation, and heap-based top-k selection.
Heaps, Sorting & Searchgreedyhashmapheapoptimization - Heaps, Sorting & SearchMediumAuto-gradedGrouped Median Property Price by Region
Tests ability to compute per-group medians over a list of records, correctly handling odd/even counts, duplicate values, and half-up rounding to two decimal places.
Heaps, Sorting & Searchsortinggroupingmediandecimal-precision - Heaps, Sorting & SearchMediumAuto-gradedK Most Common Values in an Array
Tests frequency counting and top-k selection using hash maps, heaps, or bucket sort, including complexity trade-off reasoning.
Heaps, Sorting & Searchhash-mapheapbucket-sort - Heaps, Sorting & SearchMediumAuto-gradedBest Recall Cutoff That Meets a Minimum Precision Target
Tests threshold search on a scored ranking: find the cut-point that maximises recall while keeping precision at or above a given floor, with correct tie-breaking.
Heaps, Sorting & Searchsortingprecision-recallbinary-classification - Heaps, Sorting & SearchMediumAuto-gradedUnique Element Count via Binary Search Jumps
Count unique values in a sorted array by jumping between runs using binary search, achieving sublinear time when diversity is low.
Heaps, Sorting & Searchbinary-searcharrayssorted-arrayoptimization - Heaps, Sorting & SearchMediumAuto-gradedTask Scheduler with Parallel Workers
Simulate dispatching sequential tasks to parallel workers and determine when all work completes.
Heaps, Sorting & Searchheapsimulationgreedy - Heaps, Sorting & SearchHardModel answerLocate Local Minima Using Divide-and-Conquer
Implement sublinear algorithms to identify a local minimum in a 1D array and a 2D grid by applying binary search to unimodal descent.
Heaps, Sorting & Searchbinary-searchdivide-and-conqueralgorithms - Heaps, Sorting & SearchMediumAuto-gradedTop-K Labels by Frequency with Alphabetical Tie-Breaking
Tests frequency counting and compound-key sorting to find the k most common strings, resolving ties by alphabetical order for both ranking and inclusion.
Heaps, Sorting & Searchsortinghash-mapheap - Heaps, Sorting & SearchEasyAuto-gradedMinimum Consecutive Gap Frequency
Sort an array, find the smallest difference between adjacent elements, and count how many consecutive pairs share that difference.
Heaps, Sorting & Searcharrayssortingcounting - Heaps, Sorting & SearchHardAuto-gradedNearest Profiles by Masked Mean Squared Error
Tests pairwise distance computation with a missing-data-aware MSE metric, tie-breaking, and top-K ranking across user profiles.
Heaps, Sorting & Searchsortingsimilaritymissing-data