practice a little every day — you've got this ♡
Heaps, Sorting & Search Interview Problems
Practice 5966 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.
- 5966
- Problems
- 2209
- Auto-graded
- 15
- Topics
- 271
- Added today
Showing 1–30 of 169 results
- Heaps, Sorting & SearchEasyAuto-gradedAdaptive Merge Sort with Comparison Counter
Count element-level comparisons during an adaptive divide-and-conquer merge sort.
Heaps, Sorting & Searchsortingdivide-and-conquerrecursionarrays - Heaps, Sorting & SearchMediumAuto-gradedRolling Window Mean After Dropping the Largest k
Compute the mean of each fixed-size window after discarding its k largest values, which needs a structure that supports fast insertion, deletion and sum-of-smallest queries.
Heaps, Sorting & Searchsliding-windowfenwick-treeorder-statisticsheaps - Heaps, Sorting & SearchMediumAuto-gradedPodium Finish: Pick the Two Best Clubs in a League Table
Rank teams with a multi-level tiebreak (points, goal difference, goals scored, index) and return the best two indices, testing composite keys and efficient selection.
Heaps, Sorting & Searchsortingtuple-keystie-breakingselection - Heaps, Sorting & SearchEasyAuto-gradedLast Stone Standing: Repeated Smash of the Two Heaviest Weights
Simulate repeatedly removing the two largest values and reinserting their difference, using a max-heap to find the last remaining value or 0.
Heaps, Sorting & Searchheappriority-queuesimulation - Heaps, Sorting & SearchEasyAuto-gradedLocate Element in Sorted Array
Perform logarithmic-time binary search on a strictly increasing array of distinct integers to find a target value's index or detect its absence.
Heaps, Sorting & Searchbinary-searcharrayssearching - Heaps, Sorting & SearchEasyAuto-gradedLocate the Span of a Value in a Sorted List
Use binary search to find the first and last positions of a value in a sorted list in logarithmic time, returning [-1, -1] when it is absent.
Heaps, Sorting & Searchbinary-searchsorted-arrayboundaries - Heaps, Sorting & SearchMediumAuto-gradedCombine Several Ascending Sequences into One Sorted Sequence
Merge k individually sorted integer arrays into a single sorted array, testing heap-based k-way merging or pairwise divide-and-conquer and the associated complexity analysis.
Heaps, Sorting & Searchheapk-way-mergedivide-and-conquersorting - Heaps, Sorting & SearchMediumAuto-gradedGreedy Tile Placement Across Parallel Lanes
Simulate placing items one by one into the currently lowest lane, breaking ties by lowest index, and report each lane's final total using a min-heap.
Heaps, Sorting & Searchheapgreedysimulationpriority-queue - Heaps, Sorting & SearchMediumAuto-gradedEvaluate a Broken-Line Curve at a Query Position
Sort scattered points by x, then find the y on the connecting line at a query x, interpolating inside the range and extending the end segments outside it.
Heaps, Sorting & Searchbinary-searchsortinginterpolationgeometry - Heaps, Sorting & SearchMediumAuto-gradedOrder Transformed Values of a Sorted Array
Apply a quadratic mapping to a sorted list of numbers and return the sorted results in O(n) time.
Heaps, Sorting & Searchtwo-pointersarraysmath - Heaps, Sorting & SearchMediumAuto-gradedLargest Threshold Met by Daily Step Counts
Find the largest integer k such that at least k entries in a list are at least k, testing sorting or counting-based selection and reasoning about monotone thresholds.
Heaps, Sorting & Searchsortingcountingh-indexarrays - Heaps, Sorting & SearchMediumAuto-gradedTruncate and Renormalize a Next-Token Distribution
Sort a probability list with deterministic tie-breaking, then build two truncated, renormalized versions: fixed-size top-k and cumulative-mass top-p.
Heaps, Sorting & Searchsortingprefix-sumprobabilityfloating-point - Heaps, Sorting & SearchMediumAuto-gradedLocate a Value in a Cyclically Shifted Ascending List
Search a cyclically shifted strictly increasing list of distinct integers for a value in O(log n), returning its index or -1, including unshifted and single-element cases.
Heaps, Sorting & Searchbinary-searcharraysrotated-arraydivide-and-conquer - Heaps, Sorting & SearchMediumAuto-gradedStable Divide-and-Conquer Sort of an Integer List
Sort a list of integers in ascending order without mutating the input, using a divide-and-conquer merge approach that guarantees O(n log n) time and linear auxiliary space.
Heaps, Sorting & Searchsortingdivide-and-conquermerge-sortstability - Heaps, Sorting & SearchMediumAuto-gradedRank Selection Plus Longest Leave-Assisted Break
Combines selecting the element at a 0-indexed rank in descending order with a sliding window finding the longest stretch containing at most a given number of workdays.
Heaps, Sorting & Searchheapsliding-windowtwo-pointersorder-statistics - Heaps, Sorting & SearchMediumAuto-gradedIdentify Unique Zero-Sum Triples
Find all distinct combinations of three elements in an integer sequence that sum to zero using two pointers and duplicate handling.
Heaps, Sorting & Searcharraystwo-pointerssorting - Heaps, Sorting & SearchMediumAuto-gradedFind Earliest Compatible Release Version
Find the smallest semantic version that satisfies a monotonic compatibility check while minimizing evaluations.
Heaps, Sorting & Searchbinary-searchsortingarrays - Heaps, Sorting & SearchMediumAuto-gradedMost Frequent Ads Within a Closed Time Range
Select the K most frequent ad IDs among timestamped impressions in an inclusive window, breaking ties by smaller ID; tests binary search on sorted data plus counting and ordering.
Heaps, Sorting & Searchbinary-searchhash-mapsortingsliding-window - Heaps, Sorting & SearchMediumAuto-gradedPick the k-th Smallest Value Without Fully Sorting
Find the k-th smallest value in an unsorted integer list, counting duplicates, using a linear-time selection idea such as quickselect instead of a full sort.
Heaps, Sorting & Searchquickselectselectionpartitioningorder-statistics - Heaps, Sorting & SearchMediumAuto-gradedWindow Mean After Discarding the Top Values
Compute the mean of every fixed-size window after removing its k largest entries, which requires an ordered structure that supports efficient insertion and deletion.
Heaps, Sorting & Searchsliding-windowheapfenwick-treeorder-statistics - Heaps, Sorting & SearchMediumAuto-gradedBatched Binary Search with Query Caching
Evaluate efficient sorted array lookups for repetitive queries using binary search combined with memoization.
Heaps, Sorting & Searchbinary-searcharraysmemoizationhashing - Heaps, Sorting & SearchMediumAuto-gradedRead a Value Off a Connected Line-Segment Graph
Evaluate a piecewise linear curve at a query coordinate by locating the right segment with binary search and interpolating, returning None outside the curve's domain.
Heaps, Sorting & Searchbinary-searchinterpolationarraysedge-cases - Heaps, Sorting & SearchMediumAuto-gradedRotated Array Lookup Plus Most Common Values
Find a value's index in a rotated sorted array with binary search, then list the k most frequent values with ties broken by smaller value.
Heaps, Sorting & Searchbinary-searchrotated-arrayhash-mapfrequency-count - Heaps, Sorting & SearchMediumAuto-gradedRank Point Pairs by Bounding Hyperrectangle Volume
Enumerate point pairs in d dimensions, compute the volume of the box they span, drop flat boxes, and return the rest in a strict multi-key order.
Heaps, Sorting & Searchsortingpair-enumerationgeometrymulti-key-sort - Heaps, Sorting & SearchMediumAuto-gradedBuild a Max-Heap In Place with Bottom-Up Sifting
Convert an integer list into a max-heap layout using the bottom-up sift-down procedure, matching an exact output array including tie-break behavior.
Heaps, Sorting & Searchheaparraysift-downin-place - Heaps, Sorting & SearchEasyAuto-gradedPermutation Search Sort: Order a List by Brute Force
Implement a factorial-time sort that tries arrangements until one is non-decreasing, handling duplicates and empty input, and reason about its cost.
Heaps, Sorting & Searchsortingpermutationsbrute-forcecomplexity-analysis - Heaps, Sorting & SearchEasyAuto-gradedImpute Missing Grades and Rank Top Candidates
Process raw assessment records by replacing missing marks with course-level medians and return the top 5 performers.
Heaps, Sorting & Searchsortingdata-cleaninghash-tableaggregations - Heaps, Sorting & SearchMediumAuto-gradedDeadline-Priority Ordering of Dependent Jobs
Produce an execution order for jobs with prerequisites by always running the ready job with the earliest deadline, breaking ties by id, using topological sort with a heap.
Heaps, Sorting & Searchtopological-sortheapgraphpriority-queue - Heaps, Sorting & SearchMediumAuto-gradedBoosting Your Budget With a Limited Number of Ventures
Greedy selection with a sorted unlock pointer and a max-heap: repeatedly pick the most profitable venture whose entry threshold fits the current funds, up to a fixed number of picks.
Heaps, Sorting & Searchheapgreedysortingpriority-queue - Heaps, Sorting & SearchMediumAuto-gradedSmallest Conveyor Load Limit for Sequential Parcels
Find the minimum per-day load limit that moves an ordered list of parcels in at most a given number of days, using binary search on the answer with a greedy feasibility check.
Heaps, Sorting & Searchbinary-searchgreedysearch-on-answerarrays