KatInterview

practice a little every day — you've got this ♡

Heaps, Sorting & Search Interview Problems

Practice 5967 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.

5967
Problems
2210
Auto-graded
15
Topics
272
Added today

Showing 181–200 of 200 results

  • Heaps, Sorting & SearchMediumAuto-graded
    Running Median from Integer Stream

    Tests ability to maintain order statistics efficiently in a streaming context using heap-based data structures.

    Heaps, Sorting & Searchheapsstreaming-algorithmsdata-structures
  • Heaps, Sorting & SearchMediumModel answer
    Budget-Constrained Selection and Graph Distance Query

    Find how many sorted items fit within a budget using prefix sums and binary search, then parse a graph and compute the shortest path between two nodes.

    Heaps, Sorting & Searchbinary-searchdijkstraprefix-sumshortest-path
  • Heaps, Sorting & SearchMediumModel answer
    Optimal Order Fulfillment with Decaying Prices

    Determine the maximum revenue when fulfilling orders from inventory where each item's price equals its current stock level and decreases with each sale.

    Heaps, Sorting & Searchbinary-searchgreedymathpriority-queue
  • Heaps, Sorting & SearchEasyAuto-graded
    Minimum Largest Piece After K Cuts on a Log

    Tests binary search on the answer to find the minimum possible largest piece when splitting a log into at least K+1 pieces.

    Heaps, Sorting & Searchbinary searchgreedysorting
  • Heaps, Sorting & SearchMediumAuto-graded
    Count Active Users in Trailing Time Window

    Tests binary search on sorted lists to efficiently count distinct entities with at least one event in a sliding time range.

    Heaps, Sorting & Searchbinary-searchtime-seriessliding-window
  • Heaps, Sorting & SearchEasyAuto-graded
    Running Median After Each Insertion

    Tests median maintenance using two heaps to efficiently return the running median after each element is added to a growing sequence.

    Heaps, Sorting & Searchheapssortingmedian maintenance
  • Heaps, Sorting & SearchMediumAuto-graded
    Count Valid Number Triplets Within Range

    Find how many ways to pick three numbers from an array where the maximum minus the minimum stays within a given threshold.

    Heaps, Sorting & Searchsortingtwo-pointerscombinatorics
  • Heaps, Sorting & SearchMediumAuto-graded
    Unique Element Count in Sorted Array with Binary Search

    Tests efficient counting of distinct values in a sorted array using binary search to skip duplicate runs, achieving better than linear time complexity.

    Heaps, Sorting & Searchbinary-searcharraysoptimization
  • Heaps, Sorting & SearchMediumModel answer
    Binary Search Optimization and Interval Consolidation

    Find the minimal rate to process items within a time limit, then consolidate overlapping ranges into non-overlapping spans.

    Heaps, Sorting & Searchbinary-searchintervalsgreedyoptimization
  • Heaps, Sorting & SearchMediumAuto-graded
    Rank Tournament Leaders by Multi-Level Criteria

    Tests sorting and aggregation skills by computing tournament standings with points, goal difference, and goals scored as tie-breakers.

    Heaps, Sorting & Searchsortingsimulationaggregation
  • Heaps, Sorting & SearchMediumAuto-graded
    Locate the Transition Point in a Monotonic Boolean Array

    Identify the earliest index where a boolean array transitions from False to True, testing binary search on boundaries and edge cases.

    Heaps, Sorting & Searchbinary-searcharraysboundaries
  • Heaps, Sorting & SearchMediumAuto-graded
    Sort Competitors by Vote Position Counts

    Tests multi-criteria sorting with position-based vote counting and lexicographic tiebreaking.

    Heaps, Sorting & Searchsortingcustom-comparatorcounting
  • Heaps, Sorting & SearchMediumModel answer
    Merge Sorted Runs by Absolute Value and Extract k-th Element

    Reorder a sorted array by absolute value in linear time, then find the k-th element in that order using logarithmic-time search without materializing the full result.

    Heaps, Sorting & Searchbinary-searchtwo-pointersorder-statisticsarray-manipulation
  • Heaps, Sorting & SearchMediumAuto-graded
    Minimize Maximum Delivery Time Across Warehouses

    Tests binary search on the answer to find the minimum possible maximum delivery time when assigning shipments to warehouses with limited daily capacity.

    Heaps, Sorting & Searchbinary searchgreedysorting
  • Heaps, Sorting & SearchMediumAuto-graded
    Schedule Tasks by Deadline and Priority

    Tests the ability to sort a list of tasks using a multi-key custom comparator involving deadlines, priorities, and tie-breaking rules.

    Heaps, Sorting & Searchsortingcustom sort keysheaps
  • Heaps, Sorting & SearchEasyAuto-graded
    Top-K Most Frequent Words With Tie-Breaking

    Tests ability to retrieve the k most frequent words from a list, using lexicographic order as a tie-breaker, via a heap or sort-based approach.

    Heaps, Sorting & Searchheapsortinghash map
  • Heaps, Sorting & SearchEasyAuto-graded
    Top-K Most Frequent Words by Score

    Tests ability to rank words by a weighted frequency-length score, applying top-k selection with a precise tie-breaking rule.

    Heaps, Sorting & Searchheapsortingtop-kstrings
  • Heaps, Sorting & SearchEasyAuto-graded
    Running Median of a Sliding Window

    Tests median maintenance by computing the running median after each element is inserted into a growing sequence, using a two-heap approach.

    Heaps, Sorting & Searchheapssortingmedian maintenance
  • Heaps, Sorting & SearchMediumAuto-graded
    Minimum Maximum Workload: Assign Tasks to Workers

    Tests ability to binary search on the answer to find the minimum possible maximum workload when distributing tasks among workers.

    Heaps, Sorting & Searchbinary searchgreedysorting
  • Heaps, Sorting & SearchMediumAuto-graded
    Rank Teams by Weighted Voting Tiers

    Tests the ability to design a multi-key custom sort comparator over aggregated data using a priority-queue-style ranking of teams from ranked ballots.

    Heaps, Sorting & Searchsortingcustom sort keyshash maps