KatInterview

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.

Problems200

24 easy163 medium13 hard

Showing 151–180 of 200 results

  • Tests greedy algorithm design and min-heap operations to repeatedly merge pairs optimally.

    Auto-gradedheapgreedypriority-queue
  • Find a hidden number using binary search when each query returns the result of your previous guess instead of your current one.

    Model answerbinary-searchalgorithmsfeedback-systems
  • Tests array manipulation, hash-based deduplication, and implementing an O(n log n) sort from scratch without relying on built-in sort utilities.

    Auto-gradedarrayssortinghashingheapsort
  • Tests binary search on the answer combined with a greedy coverage check to find the minimum broadcast power so every city is reachable from a central hub.

    Auto-gradedbinary searchgreedysorting
  • Tests order-statistics intuition by asking candidates to extract the k-th largest element from an unsorted array without a full sort.

    Auto-gradedheapsortingorder-statistics
  • Tests ability to implement iterative binary search with correct loop invariants, boundary handling, and termination conditions.

    Auto-gradedbinary-searcharraysiterativealgorithm-implementation
  • Tests the ability to simulate event scheduling with delayed assignments using two priority queues to track which resource handles the most requests.

    Auto-gradedheapsimulationgreedypriority-queue
  • Tests whether a candidate can reformulate a greedy revenue problem into summing the largest elements across union-of-range price sets and implement an O(n log n) layer-sweep solution.

    Auto-gradedgreedysortingmath
  • Tests heap-based selection and distance computation to efficiently find the k points closest to the origin in 2D space.

    Auto-gradedheapdistanceselectionoptimization
  • Tests binary search on sorted arrays to locate a contiguous window of k elements with minimum distance to a target value.

    Auto-gradedbinary-searchtwo-pointerssliding-window
  • Tests ability to find the kth smallest element from two sorted arrays using binary search on partition counts rather than merging.

    Auto-gradedbinary-searcharraystwo-pointers
  • Tests filtering, multi-level sorting with custom tie-breaking rules, and efficient top-K selection from structured data.

    Auto-gradedsortingfilteringheappriority-queue
  • Tests divide-and-conquer merging and two-pointer techniques to efficiently combine many pre-sorted lists.

    Auto-gradeddivide-and-conquertwo-pointersmerging
  • Tests whether a candidate can use a min-heap to efficiently merge multiple sorted lists into a single sorted output in O(N log k) time.

    Auto-gradedheapmergesorting
  • Implement a single-pass, memory-efficient weighted sampler that draws k distinct items proportional to weight from a potentially huge stream.

    Model answerreservoir-samplingprobabilitynumerical-stabilityheap
  • Tests whether a candidate can exploit strict row-chaining in a sorted matrix to locate a target value in O(log(m·n)) time using a single binary search.

    Auto-gradedbinary-searcharraysmatrix
  • Tests heap-based merging of multiple sorted sequences under strict O(k) space while maintaining stable duplicate handling.

    Auto-gradedheapsortingmergespace-complexity
  • Tests greedy heap-based merge cost minimization and prefix-sum sliding-window removal to minimize adjacent absolute differences.

    Auto-gradedgreedyheapprefix-sumssliding-window
  • Tests binary search boundary reasoning on a sorted sequence with duplicate timestamps and inclusive range semantics.

    Auto-gradedbinary-searcharrayssorting
  • Tests whether a candidate can efficiently extract the k pairs with smallest gap from a sorted array using a heap-based k-way merge instead of brute force enumeration.

    Auto-gradedheapsortingtwo-pointersarrays
  • Tests frequency counting with hash maps and efficient selection of top elements using heap-based algorithms.

    Auto-gradedhash-mapheapcountingfrequency-analysis
  • Tests combining priority-queue graph traversal with bottleneck optimization to find the path whose minimum cell value is maximized.

    Auto-gradedgraph-traversaldijkstrabinary-searchunion-find
  • Tests two-heap streaming median maintenance combined with exact integer floor-log₂ bucketing to place each median into its enclosing power-of-two interval.

    Auto-gradedheapsmedianbit-manipulation
  • Construct a working min-heap from scratch, then apply it to schedule dependent tasks in lexicographic order while detecting cycles.

    Auto-gradedheaptopological-sortgraphdata-structures
  • Tests binary search on the answer combined with greedy feasibility checking to minimize the maximum delivery time when assigning parcels to couriers.

    Auto-gradedbinary searchgreedysorting
  • Tests binary search on the answer to find the minimum integer bandwidth that allows streaming a list of files (each with a size and deadline) without missing any deadline using a greedy scheduler.

    Auto-gradedbinary searchgreedysorting
  • Tests greedy allocation with heap-based selection and mathematical reasoning about resource constraints under distinct-element requirements.

    Auto-gradedgreedyheapcombinatorics
  • Tests knowledge of two-phase external sorting: chunking a sequence into fixed-size sorted runs, then merging them efficiently with a min-heap.

    Auto-gradedheapsortingmergesimulation
  • Tests whether a candidate can count strict-win outcome pairs across two multi-faced dice efficiently using sorting and binary search instead of a brute-force double loop.

    Auto-gradedbinary-searchsortingprobabilityarrays
  • Tests understanding of lower-bound binary search with correct boundary handling and duplicate treatment.

    Auto-gradedbinary-searchboundariesduplicates

More topics