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 61–90 of 200 results
Select the k smallest values from an unsorted integer list, keeping duplicates and returning them sorted ascending, which tests heap, sorting and selection trade-offs.
Auto-gradedheapsortingselectiontop-kEvaluate dynamic range-query operations on 1D coordinates to test whether continuous subsegments contain obstacles.
Auto-gradedheaps-sortingbinary-searchfenwick-treesegment-treeBuild a piecewise linear function from unordered sample points and evaluate it at one query, extending the end segments outward, using sorting and binary search.
Auto-gradedbinary-searchsortinginterpolationfloating-pointFind the k-th largest integer in an unsorted list efficiently using quickselect or priority queues.
Auto-gradedheaps-sortingarraysquickselectFind all distinct non-decreasing 3-element value combinations in an array that add up to a specified target value.
Auto-gradedarrayssortingtwo-pointersSimulate the execution and triggering order of multiple scheduled timers using a min-heap under system clock advancements.
Auto-gradedheappriority-queuedesignsimulationSelect the k cheapest cross-array pairs from two sorted lists using a heap-based k-way merge, with a deterministic ordering for ties.
Auto-gradedheapk-way mergesorted arrayspriority queueGreedy plus min-sorted unlocking and a max-heap: pick up to k ventures, each requiring a minimum budget, to maximize the final budget.
Auto-gradedgreedyheapsortingpriority-queueDesign an index sampler where each element's probability of being chosen is proportional to its assigned weight.
Model answerprefix-sumbinary-searchrandomizationdata-structure-designUse binary search to find the first and last positions of a value in a sorted list with duplicates, in logarithmic time, returning [-1, -1] if it is absent.
Auto-gradedbinary-searcharraysbisectsorted-arrayLocate a local peak index in an array via binary search and generate minimal unambiguous string abbreviations for a list of words.
Auto-gradedbinary-searchstringshash-maparraysFind the k-th smallest element across two sorted arrays and count their unique shared elements efficiently.
Auto-gradedheaps-sortingarraysbinary-searchFind when the last vehicle leaves a segment and which one it is, when equal-speed vehicles reverse on contact, using pass-through equivalence and order preservation.
Auto-gradedsortingsimulation-shortcutghost-particlesordering-invariantAdapt binary search to locate the starting and ending index of a target value in a sorted sequence in logarithmic time.
Auto-gradedbinary-searcharrayssearchingMerge two unordered arrays of integers into a single list arranged in non-decreasing order.
Auto-gradedsortingarraysfundamentalsFind the kth largest value in the union of two ascending integer lists, counting duplicates, ideally using binary search on a partition instead of a full merge.
Auto-gradedbinary-searchsorted-arraysorder-statisticstwo-arraysRank strategies by the chance of a positive next-day return, using a predictive spread that includes both daily volatility and uncertainty in the estimated mean.
Auto-gradedsortingstatisticscustom-keyprobabilitySchedule tasks subject to dependency constraints, priority ordering, tag-based task filtering with dependency splicing, and cycle detection.
Auto-gradedheaps-sortingtrees-graphstopological-sortCombine many ascending integer lists into one ascending list with each distinct value appearing once, ideally using a heap-based k-way merge.
Auto-gradedheapk-way-mergededuplicationsorted-arraysOrder a list of nonnegative integers so that joining their decimal forms gives the biggest possible number, using a pairwise concatenation comparator and handling the all-zero case.
Auto-gradedsortingcustom-comparatorstringsgreedyImplement a priority-queue task runner that handles delayed execution without busy-waiting.
Model answerheappriority-queuedesign-dstime-complexityPropose a fully correct yet highly inefficient sorting algorithm, prove its termination and correctness, and derive its time and space complexity.
Model answersortingcomplexity-analysiscombinatoricsrecursionValidate probability weights and map pre-generated uniform float values to discrete outcomes using prefix sums and binary search.
Auto-gradedarraysbinary-searchmathvalidationFind the k-th largest value in an unsorted array of integers without fully sorting the input.
Auto-gradedarrayssortingdivide-and-conquerquickselectCount item occurrences and retrieve the top k highest-frequency elements, sorting tied elements by value ascending.
Auto-gradedarrayssortinghash-tableBuild a pager over transaction records that sorts newest-first with a deterministic tie-break and supports offset and keyset-cursor navigation with correct metadata.
Auto-gradedsortingpaginationkeyset-cursortie-breakingFind a pair of distinct elements in an array whose sum has the smallest absolute value, breaking ties deterministically.
Auto-gradedarraysbinary-searchsortingtwo-pointersEnumerate all unique permutations of an integer list containing duplicates in lexicographically sorted order.
Auto-gradedarrayssortingbacktrackingrecursionDesign scalable algorithms to extract the top K most frequent elements from a data stream under both memory-bounded exact and memory-constrained approximate regimes.
Model answerheaps-sortingdesign-dsarraysSimulate a stream of purchase and refund events that drain gift cards by expiry priority, surcharge the card remainder by ZIP range, and turn excess refunds into store credit.
Auto-gradedsimulationheappriority-queuebinary-search