Topic
Heaps, Sorting & Search interview problems
Priority queues, binary search and custom ordering. 200 original problems, each with hidden test cases you can run in the browser.
24 easy163 medium13 hard
Showing 121–150 of 200 results
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.
Auto-gradedheapsortingsimulationoffline-processingMaintain the median of a growing sequence after each new value arrives, testing efficient order-statistic upkeep with a pair of heaps.
Auto-gradedheaptwo-heapsstreamingmedianFind the k-th largest value in an unsorted integer list, counting duplicates separately, without necessarily sorting the whole list.
Auto-gradedheapquickselectselectionarraysPlace a depot on a 2D integer grid to minimize total Manhattan distance to all warehouses, avoiding any cell occupied by an obstacle.
Model answermanhattan-distancemedianpriority-queueprefix-sumsFind one conflicting pair among n items using a black-box oracle that tests subsets, minimizing the number of expensive queries.
Model answerbinary-searchoptimizationoracleinformation-theoryTests binary search on window positions with careful tie-breaking that prefers smaller values when distances are equal.
Auto-gradedbinary-searchsliding-windowtwo-pointersTests prefix sums and binary search to map ticket numbers into population-weighted ranges efficiently.
Auto-gradedbinary-searchprefix-sumsarraysTests binary search on sorted arrays with duplicates to answer multiple inclusive range queries in O(log n) per query.
Auto-gradedbinary-searcharraystwo-pointersTests implementation of quickselect to find the k-th largest value in an unsorted array, treating duplicates as separate elements.
Auto-gradedquickselectpartitioningselection-algorithmsFind the smallest valid ordering of numbered items when some must precede others, or detect when circular dependencies make ordering impossible.
Auto-gradedtopological-sortgraphheapgreedyTests 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.
Auto-gradedheapmergek-way-mergerunning-sumTests efficient multi-way merge using a min-heap to extract the k smallest values from multiple sorted arrays without flattening the entire input.
Auto-gradedheapmergesortingoptimizationFind the max and min sliding-window medians in O(n log k), then partition a binary array into even uniform segments with minimum flips.
Model answersliding windowheapdynamic programmingbinary arrayTests sorting and greedy scanning to identify the smallest gap between elements and extract all pairs achieving it.
Auto-gradedsortinggreedyarraysTests the ability to partition an array into three distinct categories using a single-pass, constant-space algorithm.
Auto-gradedarraystwo-pointerssortingpartitioningTests simulation using a priority queue with lazy deletion and a linked list to repeatedly remove the smallest remaining element and its current neighbors.
Auto-gradedheaplinked-listsimulationlazy-deletionTests whether a candidate can isolate records by category and then apply binary search to efficiently locate all entries within an inclusive date window.
Auto-gradedbinary-searchsortingdata-manipulationTests whether a candidate can recognize a monotonic predicate and apply binary search to find the first transition point without comparing version strings.
Auto-gradedbinary-searcharraysmonotonic-predicateTests whether a candidate can run a single-pass binary search on a sorted array that has been cyclically shifted by an unknown offset.
Auto-gradedbinary-searcharraysdivide-and-conquerTests 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.
Auto-gradedbinary-searchmatrixheapTests greedy optimization with category constraints, hash-map aggregation, and heap-based top-k selection.
Auto-gradedgreedyhashmapheapoptimizationTests 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.
Auto-gradedsortinggroupingmediandecimal-precisionTests frequency counting and top-k selection using hash maps, heaps, or bucket sort, including complexity trade-off reasoning.
Auto-gradedhash-mapheapbucket-sortTests 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.
Auto-gradedsortingprecision-recallbinary-classificationCount unique values in a sorted array by jumping between runs using binary search, achieving sublinear time when diversity is low.
Auto-gradedbinary-searcharrayssorted-arrayoptimizationSimulate dispatching sequential tasks to parallel workers and determine when all work completes.
Auto-gradedheapsimulationgreedyImplement sublinear algorithms to identify a local minimum in a 1D array and a 2D grid by applying binary search to unimodal descent.
Model answerbinary-searchdivide-and-conqueralgorithmsTests frequency counting and compound-key sorting to find the k most common strings, resolving ties by alphabetical order for both ranking and inclusion.
Auto-gradedsortinghash-mapheapSort an array, find the smallest difference between adjacent elements, and count how many consecutive pairs share that difference.
Auto-gradedarrayssortingcountingTests pairwise distance computation with a missing-data-aware MSE metric, tie-breaking, and top-K ranking across user profiles.
Auto-gradedsortingsimilaritymissing-data