KatInterview

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

Greedy & Intervals Interview Problems

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

5965
Problems
2208
Auto-graded
15
Topics
271
Added today

Showing 1–20 of 20 results

  • Greedy & IntervalsMediumModel answer
    Find the Largest Non-Decreasing Integer Below N

    Find the maximum integer less than or equal to n whose decimal digits do not decrease from left to right.

    Greedy & Intervalsgreedymath-bitsstrings
  • Greedy & IntervalsMediumModel answer
    Staffing Timeline from Overlapping Work Shifts

    Turn a list of overlapping employee shifts into contiguous time segments, each listing who is on duty, with empty segments marking gaps in coverage.

    Greedy & Intervalssweep-lineintervalshash-mapsorting
  • 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 & 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 & 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 & IntervalsMediumModel answer
    Pinpoint Bad Nodes with Disjoint Group Probes of Size Two or More

    Find exactly which cluster nodes are bad when the only probe is a group test that fails if any member is bad, parallel probes must be disjoint, and each probe needs at least two nodes.

    Greedy & Intervalsgroup-testingadaptive-algorithmsround-robin-schedulingidentifiability
  • Greedy & IntervalsMediumModel answer
    Smallest Vehicle Pool for Location-Bound Shuttle Runs

    Given timed runs between named stops, find the fewest shuttles needed when each shuttle can only continue from the stop where its previous run ended.

    Greedy & Intervalssweep-linesortingeventsgreedy
  • Greedy & IntervalsHardModel answer
    Bird Physics Tick and Fee-Ratio Block Packing

    Two coding tasks: a one-tick bird movement function with inclusive bounds, and a greedy block builder that scores transactions together with their unconfirmed ancestors.

    Greedy & Intervalsgreedytopological-sortcycle-detectionsimulation
  • Greedy & IntervalsMediumModel answer
    Matrix 90-Degree Clockwise Rotation and Maximum Interval Coverage

    Rotate a square grid 90 degrees clockwise and identify regions of maximal overlapping intervals using a sweep-line algorithm.

    Greedy & Intervalsarraysgreedy-intervalsheaps-sorting
  • Greedy & IntervalsMediumModel answer
    Real-Time Courier-to-Delivery Matching Engine Design

    Design a scalable real-time engine that matches couriers to incoming delivery requests, defining the cost model, candidate pruning, matching method, complexity, and failure handling.

    Greedy & Intervalsmatchinggreedyspatial-indexreal-time
  • 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 & 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 & 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 & 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 & 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 & 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 & IntervalsHardModel answer
    Equalize Array Range with Bounded Transfers

    Find the minimum operations to narrow an array's range below a threshold by transferring bounded amounts between pairs of elements.

    Greedy & Intervalsgreedybinary-searchmathoptimization
  • Greedy & IntervalsMediumModel answer
    Peak Active Couriers: Sweep-Line with Per-Worker Deduplication

    Given delivery records with overlapping intervals per courier, find the maximum number of distinct couriers working simultaneously using a sweep-line algorithm.

    Greedy & Intervalssweep-lineintervalsdeduplicationsorting