KatInterview

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

Greedy & Intervals Interview Problems

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

5971
Problems
2211
Auto-graded
15
Topics
272
Added today

Showing 91–120 of 181 results

  • Greedy & IntervalsMediumAuto-graded
    Fewest Conference Rooms for a Day of Bookings

    Compute the minimum number of rooms needed to host all time-range bookings when back-to-back bookings may reuse a room, testing sweep-line or heap-based interval reasoning.

    Greedy & Intervalsintervalsheapsweep-linesorting
  • Greedy & IntervalsMediumAuto-graded
    Fewest Drivers to Cover Every Trip Without Overlap

    Find the fewest drivers needed to serve all trips given [start, end) times, which reduces to the peak number of simultaneous trips and tests sweep-line or heap handling of boundaries.

    Greedy & Intervalsintervalssweep-lineheapgreedy
  • Greedy & IntervalsMediumAuto-graded
    Find the First Free Slot After Busy Minutes in Text Schedules

    Parse text schedule entries into inclusive minute intervals, merge them, and find the earliest k-minute free slot that follows the first busy minute of the day.

    Greedy & Intervalsintervalsmerge-intervalsstring-parsingsorting
  • Greedy & IntervalsMediumAuto-graded
    Stock Piles Priced by Remaining Count: Maximum Earnings

    Greedy selling from the largest pile, solved in bulk with sorting and arithmetic-series sums because the number of sales is too large to simulate one by one.

    Greedy & Intervalsgreedysortingarithmetic-seriesmath
  • Greedy & IntervalsMediumAuto-graded
    Collapse Overlapping Time Ranges Into Disjoint Blocks

    Sort closed integer ranges and sweep once to combine any that overlap or touch, returning the minimal ordered list of disjoint ranges.

    Greedy & Intervalsintervalssortingsweepgreedy
  • Greedy & IntervalsMediumModel answer
    Split Overlapping Support Windows by Who Is Covering

    Break a set of possibly overlapping staffed time windows into disjoint half-open segments, each labeled with the sorted set of people covering it, dropping gaps and merging equal neighbors.

    Greedy & Intervalssweep-lineintervalshash-mapsorting
  • Greedy & IntervalsMediumAuto-graded
    Peak Concurrent Shifts Across Half-Open Time Ranges

    Find the largest number of half-open time ranges that overlap at one instant, handling shared endpoints, empty ranges and large inputs with a sweep over sorted boundaries.

    Greedy & Intervalssweep-lineintervalssortinghash-map
  • Greedy & IntervalsMediumAuto-graded
    Courier Earnings from Overlapping Order Timelines

    Sweep over unsorted accept/fulfill events to total a courier's earnings, where pay per minute scales with the number of simultaneously open orders.

    Greedy & Intervalssweep-linesortingintervalssimulation
  • Greedy & IntervalsMediumAuto-graded
    Booked Time and Peak Room Demand for a Schedule

    Compute the total time covered by a set of half-open intervals and the maximum number of simultaneously active intervals, ignoring empty or reversed ones.

    Greedy & Intervalsintervalssweep-linesortingmerge-intervals
  • Greedy & IntervalsMediumAuto-graded
    Pick One Day Per Workshop Within Its Availability Window

    Choose a distinct day for as many workshops as possible, each within its own window, using an earliest-deadline-first greedy with a min-heap.

    Greedy & Intervalsgreedyheapintervalssorting
  • Greedy & IntervalsHardModel answer
    Payroll From an Event Log With Surge Windows

    Turn a day's delivery events into total driver pay, then add doubled-rate surge windows by splitting intervals at boundaries, and decide how to handle messy or inconsistent logs.

    Greedy & Intervalsintervalsevent-processinghashingsorting
  • Greedy & IntervalsMediumAuto-graded
    Daily Flat-Fee Cap on Overlapping Job Charges

    Sum per-day min(active cost, flat fee) over huge day ranges using an event sweep, with the result taken modulo 1,000,000,007.

    Greedy & Intervalsline-sweepintervalsdifference-arraymodular-arithmetic
  • Greedy & IntervalsMediumAuto-graded
    Coalesce Touching Segments and Measure Coverage

    Merge half-open integer segments that overlap or touch end-to-start, then report the merged segments in order along with their combined covered length.

    Greedy & Intervalsintervalssortingsweepmerge
  • Greedy & IntervalsMediumModel answer
    Busiest Stretches of a Garage from Gate Scanner Records

    Use unsorted gate scan records to find peak car occupancy and the maximal time windows at that peak, including when some exit scans are missing and stays are capped.

    Greedy & Intervalssweep-lineintervalsevent-processingsorting
  • Greedy & IntervalsMediumAuto-graded
    Locate the Lowest-Indexed Room That Can Fit a Meeting

    Tests interval overlap checks under half-open semantics and using binary search on sorted, disjoint bookings to find a free room quickly.

    Greedy & Intervalsintervalsbinary-searchsortinghalf-open-ranges
  • Greedy & IntervalsMediumAuto-graded
    Count Active Ranges at Query Points

    Tests whether a candidate can efficiently count how many inclusive ranges cover each of a set of query values using binary search decomposition.

    Greedy & Intervalsbinary-searchintervalssorting
  • Greedy & IntervalsMediumAuto-graded
    Peak Activity Count from Time Intervals

    Tests sweep-line techniques for interval overlap detection, event aggregation at boundaries, and proper handling of half-open interval semantics.

    Greedy & Intervalsintervalssweep-linesortingevent-processing
  • Greedy & IntervalsHardAuto-graded
    Maximize Paired Sum with Coverage Constraint

    Tests greedy reasoning and sorting to maximize the sum of "lesser" elements across a constrained pairing of an even-length array.

    Greedy & Intervalsgreedysortingarrays
  • Greedy & IntervalsMediumAuto-graded
    Union Length of Half-Open Integer Intervals

    Merge overlapping half-open intervals to return the total length covered by at least one interval.

    Greedy & Intervalsintervalssortingsweep-linemerge
  • Greedy & IntervalsMediumAuto-graded
    Calculate Worker Pay with Bonus Time Periods

    Tests interval merging, overlap calculation, and time-based pay aggregation with capped rate multipliers.

    Greedy & Intervalsintervalsarraysmath
  • Greedy & IntervalsMediumAuto-graded
    Fewest Points to Cover a Microdollar Threshold

    Tests greedy selection when items have uniform cost but different values under capacity constraints.

    Greedy & Intervalsgreedysortingmath
  • Greedy & IntervalsMediumModel answer
    Assign Support Tickets to Agents Within Concurrency Limits

    Given a list of fixed-time support tickets, assign each to an agent while respecting per-client concurrency caps and an optional agent pool size.

    Greedy & Intervalsgreedyinterval-schedulingheapsweep-line
  • Greedy & IntervalsMediumModel answer
    Minimum Shift Count for Concurrent Task Scheduling

    Given tasks with time windows and resource demands, find the fewest parallel workers needed so no worker exceeds capacity K at any moment.

    Greedy & Intervalsgreedyintervalsheapbin-packing
  • Greedy & IntervalsMediumModel answer
    Merge Active Intervals from Multiple Time-Series Sensors

    Parse sensor streams into continuous activity windows and find time ranges where all sensors are simultaneously active.

    Greedy & Intervalsintervalstime-seriesintersectiontwo-pointers
  • Greedy & IntervalsMediumAuto-graded
    Count Active Surveillance Cameras at Each Minute

    Tests the sweep-line technique by computing, for each minute in a query list, how many camera recording intervals are active at that exact moment.

    Greedy & Intervalssweep lineintervalsgreedysorting
  • Greedy & IntervalsEasyAuto-graded
    Budget Shopping from Array Suffix

    Tests greedy selection with precomputation, prefix sums, and binary search to maximize item counts under budget constraints.

    Greedy & Intervalsgreedybinary-searchprefix-sumsorting
  • Greedy & IntervalsMediumModel answer
    Packing a Fixed-Size Block from a Large Mempool with CPFP

    Design a fee-maximizing transaction selector for a size-capped block, extend it to parent/child dependencies with CPFP scoring, and derive a minimum child fee.

    Greedy & Intervalsgreedyknapsackdependency-trackingcryptocurrency
  • Greedy & IntervalsMediumAuto-graded
    Maximize Total Score by Pairing Players Optimally

    Tests whether a candidate can apply a greedy sort-and-pair strategy to maximize the sum of pair minimums across a list of player ratings.

    Greedy & Intervalsgreedysortingarrays
  • Greedy & IntervalsMediumModel answer
    First Open Meeting Window Across All Employees

    Sweep merged busy intervals to find the earliest gap of a required duration that fits within every employee's working hours.

    Greedy & Intervalsintervalsheapmergescheduling
  • Greedy & IntervalsHardAuto-graded
    Maximize Profit from Weighted Deadline-Constrained Tasks

    Tests the classic weighted job scheduling with deadlines: greedily select a maximum-profit feasible subset of unit-length tasks, each with a deadline and profit, using a disjoint-set (union-find) structure for efficiency.

    Greedy & Intervalsgreedyschedulingunion-findintervals