KatInterview

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

Greedy & Intervals 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 31–60 of 181 results

  • Greedy & IntervalsEasyAuto-graded
    Indices of Ranges Fully Inside a Query Range

    Scan a list of closed integer ranges and return the indices of those lying entirely within a given query range, testing inclusive boundary handling.

    Greedy & Intervalsintervalsarrayscanboundary-conditions
  • Greedy & IntervalsHardAuto-graded
    Find Continuous Peak Resource Load

    Find the maximum aggregate load over a set of half-open intervals and identify the earliest contiguous time window sustaining it.

    Greedy & Intervalssweep-lineintervalsarrayssorting
  • Greedy & IntervalsEasyAuto-graded
    Till Payout: Greedy Bills and Coins, Listed A to Z

    Parse decimal money strings exactly into cents, detect underpayment or exact payment, then greedily break the change into named bills and coins and output them sorted alphabetically.

    Greedy & Intervalsgreedystringsparsingsorting
  • Greedy & IntervalsMediumModel answer
    Trim Overlapping Ranges to Limit Capacity

    Truncate overlapping integer intervals so no point is covered by more than k ranges while minimizing the total removed coverage.

    Greedy & Intervalsintervalssweep-lineheapgreedy
  • Greedy & IntervalsMediumAuto-graded
    Minimum Time Slots for Cooldown-Constrained Jobs

    Compute the shortest timeline needed to run labeled jobs when equal labels must be separated by a cooldown, using frequency counting and a greedy frame argument.

    Greedy & Intervalsgreedycountingschedulingmath
  • Greedy & IntervalsMediumModel answer
    Decode Non-Overlapping Keyphrase Spans from BERT Logits

    Implement a decoder that converts token start and end logits into non-overlapping character spans using offset mappings and greedy selection.

    Greedy & Intervalsstringsgreedy-intervalsmachine-learningsorting
  • Greedy & IntervalsEasyAuto-graded
    Settle Shared Expenses With a Two-Pointer Payment Plan

    Turn a map of net balances into a deterministic list of payments that zeroes every account, using a sorted two-pointer greedy match between debtors and creditors.

    Greedy & Intervalsgreedytwo-pointershash-mapsorting
  • Greedy & IntervalsMediumAuto-graded
    Combine Two Ordered Schedules into One Gap-Free Timeline

    Merge two sorted lists of internally disjoint closed intervals into one sorted, disjoint list, joining overlapping or endpoint-touching intervals, in linear time.

    Greedy & Intervalsintervalstwo-pointersmergesweep-line
  • Greedy & IntervalsMediumAuto-graded
    Fewest Rooms to Host All Bookings

    Find the smallest number of rooms that can host every booking at once, where a booking may begin the moment another one ends, using sorting and a min-heap.

    Greedy & Intervalsintervalsmin-heapsortinggreedy
  • Greedy & IntervalsMediumAuto-graded
    Fewest Segment Boosts to Make a Sequence Non-Decreasing

    Compute the minimum number of +1 contiguous-segment updates needed to make an array non-decreasing, using adjacent differences and a lower-bound argument.

    Greedy & Intervalsdifference-arraygreedyarraysrange-updates
  • Greedy & IntervalsMediumAuto-graded
    Fewest Steps on a Faulty Calculator: Decrement or Double

    Find the minimum number of decrement-by-one and double operations needed to turn one positive integer into another, which rewards working backward from the target with a greedy rule.

    Greedy & Intervalsgreedymathreverse-thinking
  • Greedy & IntervalsEasyAuto-graded
    Filter Financial Logs by Active Premium Periods

    Filter a chronological sequence of transaction records based on whether they fall within active premium membership intervals.

    Greedy & Intervalsintervalsdata-filteringhash-table
  • Greedy & IntervalsEasyAuto-graded
    Partition Array Under Segment Capacity Limit

    Determine the minimum number of contiguous segments needed to split an array such that no segment's total sum exceeds a specified capacity limit.

    Greedy & Intervalsarraysgreedy
  • Greedy & IntervalsMediumAuto-graded
    Longest Streak of Growing Daily Distinct Picks

    Find how many days a growing-size distinct-item picking schedule can run, using binary search on the answer plus a capacity feasibility check.

    Greedy & Intervalsgreedybinary-searchprefix-sumsfeasibility-check
  • Greedy & IntervalsHardAuto-graded
    Simulate Trading Order Fill Rate Limit

    Simulate order executions under a time-windowed volume participation constraint using a sliding window.

    Greedy & Intervalssliding-windowqueuegreedytime-series
  • Greedy & IntervalsMediumAuto-graded
    Collapse Booking Windows into Non-Touching Blocks

    Merge inclusive ranges that share at least one point into a sorted list of disjoint ranges, testing sorting, a linear sweep, and correct handling of touching endpoints and nesting.

    Greedy & Intervalsintervalssortingsweepgreedy
  • Greedy & IntervalsMediumAuto-graded
    Largest Group Anchored by One Overlapping Interval

    Find the largest set of intervals that all intersect one chosen anchor interval, using sorting and binary search to beat quadratic time.

    Greedy & Intervalsintervalsbinary-searchsortingcounting
  • Greedy & IntervalsMediumAuto-graded
    Fewest Brackets to Add for a Balanced String

    Count the fewest parenthesis insertions needed to make a string of brackets balanced, using a single left-to-right pass with a running counter.

    Greedy & Intervalsgreedystringsparenthesescounter
  • Greedy & IntervalsMediumAuto-graded
    Largest Number With Even Counts of Both Digits

    Delete characters from a string of 1s and 2s so both digit counts are even and the number is largest, testing greedy deletion with parity reasoning.

    Greedy & Intervalsgreedystringstacksubsequence
  • Greedy & IntervalsMediumAuto-graded
    Biggest Cabin Party Respecting Everyone's Companion Limits

    Find the largest group size k where at least k people accept exactly k-1 companions, using interval counting with a difference array in linear time.

    Greedy & Intervalsdifference-arrayintervalscountingprefix-sum
  • Greedy & IntervalsMediumAuto-graded
    Even Budget Split Under Per-Person Caps

    Split a budget as evenly as possible among people with individual caps, using a binary-searched fill level plus a lowest-index-first remainder rule.

    Greedy & Intervalsgreedybinary-searchwater-fillingarrays
  • Greedy & IntervalsMediumAuto-graded
    Combine Overlapping Ranges and Count Unique Land Shapes

    Merge overlapping or touching closed ranges, and count land regions in a binary grid that differ in shape when only shifting is allowed.

    Greedy & Intervalsintervalssortingdfsgrid
  • Greedy & IntervalsMediumAuto-graded
    Minimum Resources Required for Scheduled Jobs

    Determine the minimum number of resources required to run a schedule of tasks given start and end times with boundary reuse allowed.

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

    Find the fewest rooms that can host every booking in an unordered list of half-open time ranges, where back-to-back bookings may share a room.

    Greedy & Intervalsintervalssweep-linesortinggreedy
  • Greedy & IntervalsMediumAuto-graded
    Count Total Pipeline Output Within Time Constraint

    Compute the maximum number of items processed by a sequential single-threaded worker within a total allowed time limit.

    Greedy & Intervalsgreedyarraysmath
  • Greedy & IntervalsMediumModel answer
    Peak Overlap Point, Bounded BST Sums, and Call-Stack Self Time

    Three separate tasks: find an integer with the highest interval overlap, sum BST values within a range (plus many-query speedups), and compute per-function self time from nested start/end logs.

    Greedy & Intervalssweep-linebstprefix-sumsstack
  • Greedy & IntervalsEasyAuto-graded
    Does a New Booking Collide With Existing Slots?

    Decide whether a proposed half-open time slot shares any time with a list of unsorted booked slots, testing overlap logic and correct handling of touching endpoints.

    Greedy & Intervalsintervalsoverlaphalf-openlinear-scan
  • Greedy & IntervalsMediumAuto-graded
    Text Formatting and Dynamic Schedule Tracker

    Perform greedy text wrapping to fixed line widths alongside dynamic interval point queries with insertion and removal.

    Greedy & Intervalsgreedyintervalsfenwick-treecoordinate-compression
  • Greedy & IntervalsMediumAuto-graded
    Calculate Max Trading Returns from Multi-Asset Feed

    Process an unordered multi-asset market feed to find the maximum possible cumulative profit across all tickers.

    Greedy & Intervalsarraysgreedysortinghash-map
  • Greedy & IntervalsEasyAuto-graded
    Extract Continuous Active Time Windows

    Process chronological sensor sample logs to extract continuous active periods matching a minimum elapsed duration requirement.

    Greedy & Intervalsgreedy-intervalsarraystwo-pointers