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 91–120 of 200 results
Implement a two-direction adjacent-swap sort that returns a new sorted list, using window shrinking and early termination, while reasoning about its cost.
Auto-gradedsortingtwo-pointersbubble-sortin-placeSimulate a deterministic room-allocation process with heaps: sort by start, free finished rooms, pick the smallest free ID, and report assignments in input order.
Auto-gradedheapsimulationsortingintervalsGroup unsorted flight records by traveler and decide each traveler's status at a query timestamp, using half-open flight intervals.
Auto-gradedsortinghash-mapintervalstimestampsBinary search for the starting boundary of a contiguous k-element slice minimizing distance to a given target in a sorted list.
Auto-gradedbinary-searchtwo-pointersarraysFind the maximum yield from extracting resources over K time steps when each extraction reduces a site's yield by 1 using binary search on the minimum threshold.
Auto-gradedarraysheaps-sortinggreedy-intervalsmath-bitsEfficiently merge K pre-sorted event logs while combining entries sharing identical timestamps.
Auto-gradedheaps-sortingarraystwo-pointersFind the minimum of a convex/unimodal function over continuous and discrete intervals using zero-order optimization.
Model answerbinary searchoptimizationunimodalgolden sectionAnswer timestamp queries against unsorted trip intervals using sorting and binary search, handling closed boundaries, gaps between trips, and times before the first trip.
Auto-gradedbinary-searchsortingintervalssimulationCount value frequencies and pick the k most frequent values, using a bounded heap and a defined tie-break rule for equal counts.
Auto-gradedheaphash-mapfrequency-countingtop-kAnswer 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.
Auto-gradedbinary-searchsorted-arraybisectbatch-queriesDetect a missing entry in a sorted contiguous array of integers in logarithmic time using binary search.
Auto-gradedarraysbinary-searchMerge several lists of employee records, convert each salary to USD using a rate map, and return the top N earners with a deterministic tie-break.
Auto-gradedsortinghash-mapdata-manipulationsimulationFind a valley index in an array of adjacent-distinct integers in logarithmic time, using a fixed halving rule that makes the returned index deterministic.
Auto-gradedbinary-searcharraysinvariantsiterativeFilter records by a minimum score, order them by score then id, and return one page after a (score, id) cursor along with the cursor for the following page.
Auto-gradedpaginationsortingtuple-comparisonheapProcess a log of insert and query commands on a growing multiset of integers, reporting the median at each query using two heaps for efficient updates.
Auto-gradedheaptwo-heapsstreamingmedianAggregate per-ad records by advertiser, then rank with a multi-key sort (total reports, report rate, id) and return the top k.
Auto-gradedhashingsortingaggregationcustom-sort-keyReplay a list of insert and query commands on a growing multiset of integers, reporting the median at each query; tests two-heap or order-statistic maintenance.
Auto-gradedheapstreamingmediandesignSelect the k dataset points nearest to a query in n-dimensional space, ordered by distance, with ties resolved by smaller index.
Auto-gradedk-nearest-neighborssortingheapeuclidean-distanceFind the first index of a target in a sorted list while the search pretends its length is unknown, using doubling probes followed by a lower-bound binary search.
Auto-gradedbinary-searchexponential-searchduplicatessorted-arrayFilter records with too many missing values, fill gaps with per-subject medians, then pick the top five using a multi-key sort with tie-breaks.
Auto-gradedsortingmediandata-cleaningsimulationSweep sorted feature values to find the lowest weighted-Gini binary split, and apply one MSE gradient descent update for linear regression.
Auto-gradedsortingprefix-sweepgini-impuritygradient-descentBuild a memory-safe word counter for a huge text file, define tokenization rules, return the top-k words deterministically, and discuss what to do when the vocabulary strains memory.
Model answerword-countstreaminghash-maptop-kChoose the bottle kit that serves every dose request with minimal total leftover space, using sorting, prefix sums and binary search to stay efficient on large inputs.
Auto-gradedbinary-searchprefix-sumssortinggreedyBuild a string for each anti-diagonal of a letter grid, read bottom-left to top-right, and return diagonal indices ordered by string, with ties broken by index.
Auto-gradedmatrixsortingstringstie-breakingPush messages through a provider that accepts at most 5 per call, and retry each failure only after its own cooldown expires, with an attempt cap and no busy-waiting.
Model answerbatchingpriority-queueretry-schedulingmin-heapGive worst-case Big-O for four common array, hash table and heap operations, then explain why adding threads does not always speed a program up, with concrete counterexamples.
Model answerbig-ohash-tableheapmultithreadingFind the best sum over any run of k adjacent numbers, then track the median of the latest k values in a live stream, discussing data structures, parallelism and trade-offs.
Model answersliding-windowtwo-heapsmedianlazy-deletionCombine a Huffman-style min-heap greedy for the cheapest full merge with a frequency-map count of index pairs hitting a target sum, summing their products.
Auto-gradedheapgreedyhash-mapcountingOrder a single elevator's pending floor requests using a one-reversal sweep policy with a priority queue, merging duplicates and respecting the starting direction.
Auto-gradedheappriority-queuesortingsimulationFind the first index with value at least the target in a sorted sequence of hidden length, using doubling probes followed by binary search.
Auto-gradedbinary-searchexponential-searchsorted-arrayinvariants