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 161 results

  • 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 & 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 & 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 & 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 & 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
  • Greedy & IntervalsHardAuto-graded
    Minimum Adjacent Swaps to Sort a Binary String

    Tests greedy inversion-counting on a binary string to find the minimum number of adjacent swaps needed to push all 1s to the right.

    Greedy & Intervalsgreedystringsinversion-count
  • Greedy & IntervalsMediumAuto-graded
    Maximum Non-Overlapping Meetings in a Workday

    Tests greedy interval scheduling and string parsing: convert "Name: HH:MM-HH:MM" strings into time intervals, then find the largest set of compatible meetings.

    Greedy & Intervalsgreedyintervalsstrings
  • Greedy & IntervalsEasyAuto-graded
    Consolidate Overlapping Time Ranges by Group

    Tests interval merging within distinct groups, requiring grouping logic, sorting, and adjacent-interval handling.

    Greedy & Intervalsintervalsgroupingsorting
  • Greedy & IntervalsMediumAuto-graded
    Greedy Starting Point for a Circular Fuel Route

    Tests whether a candidate can apply a greedy one-pass argument to find the unique valid departure station in a circular gas-station problem.

    Greedy & Intervalsgreedyarraystwo-pointers
  • Greedy & IntervalsMediumAuto-graded
    Consolidate Overlapping Time Ranges

    Tests whether a candidate can sort and linearly sweep a list of ranges to produce the minimal set of non-overlapping intervals covering all input.

    Greedy & Intervalsintervalssortinggreedyarray
  • Greedy & IntervalsMediumAuto-graded
    Consolidate Overlapping Ranges

    Tests interval merging with sorting, overlapping logic, and immutability constraints

    Greedy & Intervalsintervalssortinggreedyarrays
  • Greedy & IntervalsMediumAuto-graded
    Find the Highest-Scoring Boundary Pair in an Array

    Tests whether a candidate can exploit a telescoping sum identity to reduce an interval scoring problem to a fast two-endpoint selection with careful tie-breaking.

    Greedy & Intervalsarraysgreedytwo-pointers
  • Greedy & IntervalsMediumAuto-graded
    Identify Gaps in a Sorted Array Within Bounds

    Tests interval reasoning, array traversal, edge case handling with boundaries, and formatting output for missing number ranges.

    Greedy & Intervalsarraysintervalsedge-cases
  • Greedy & IntervalsMediumAuto-graded
    Consolidate Overlapping Ranges

    Tests interval merging logic, correctly handling touching boundaries, nested ranges, and producing sorted disjoint output.

    Greedy & Intervalsintervalssortinggreedy
  • Greedy & IntervalsMediumAuto-graded
    Fewest Irrigation Devices to Water a Linear Garden

    Tests greedy interval selection and the ability to handle coverage gaps in a linear range.

    Greedy & Intervalsgreedyintervalssorting
  • Greedy & IntervalsMediumAuto-graded
    Consecutive-Range Handoff Pairs for Interval Coverage

    Tests interval reasoning and efficient pairing: find all unordered listing pairs whose consecutive availability windows together cover a full date range.

    Greedy & Intervalsintervalsbinary-searchhashingsorting
  • Greedy & IntervalsMediumAuto-graded
    Track Segment Coverage by Expanding Intervals

    Tests interval merging and coverage detection with streaming data updates.

    Greedy & Intervalsintervalsmerge-intervalsdata-structuresstreaming
  • Greedy & IntervalsMediumAuto-graded
    Consolidate Overlapping Time Ranges

    Tests whether a candidate can sort and scan a list of closed intervals to collapse all overlapping or touching ranges into a minimal merged set.

    Greedy & Intervalsintervalssortinggreedy
  • Greedy & IntervalsMediumAuto-graded
    Minimum Classrooms to Schedule All Lectures

    Tests whether a candidate can reframe a resource-allocation problem as peak interval overlap and handle half-open boundary conditions correctly.

    Greedy & Intervalsintervalssweep-linegreedysorting
  • Greedy & IntervalsMediumAuto-graded
    Fill a Cargo Hold for Maximum Value With Limited Item Supply

    Tests whether a candidate can recognize that a bounded knapsack with uniform item weight reduces to a greedy sort-and-fill, handling large capacities and stock counts efficiently.

    Greedy & Intervalsgreedysortingbounded-knapsack
  • Greedy & IntervalsMediumAuto-graded
    Collect Coins with Fixed-Jump Pieces

    Tests modular arithmetic insight and greedy reasoning to determine which resources are reachable under constrained movement rules.

    Greedy & Intervalsgreedymodular-arithmeticarrays
  • Greedy & IntervalsMediumAuto-graded
    Single Buy-Sell Stock Gain

    Tests finding the maximum profit from one purchase and one sale in a price sequence using a single-pass greedy approach.

    Greedy & Intervalsgreedyarrayssliding-window
  • Greedy & IntervalsMediumAuto-graded
    Maximize Pay by Filling Gaps in a Shift Schedule

    Tests greedy reasoning and run-based reformulation to optimally spend a limited number of schedule changes for maximum earnings with streak bonuses.

    Greedy & Intervalsgreedydynamic-programmingarrays