KatInterview

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

Greedy & Intervals Interview Problems

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

5969
Problems
2211
Auto-graded
15
Topics
272
Added today

Showing 61–90 of 181 results

  • Greedy & IntervalsMediumAuto-graded
    Wildcard Brackets: Can the Sequence Be Made Valid?

    Decide if a string of brackets and wildcards can be made valid by choosing each wildcard's role, testing range-tracking of reachable open counts or a greedy two-pass argument.

    Greedy & Intervalsgreedystringsparenthesesdynamic-programming
  • Greedy & IntervalsEasyAuto-graded
    Summarize Integer Ranges into String

    Process an unorganized array of integers by sorting, deduplicating, and formatting contiguous numerical ranges into a compact string.

    Greedy & Intervalsarrayssortingintervalsstrings
  • Greedy & IntervalsMediumAuto-graded
    Collapse Booked Time Slots into Disjoint Blocks

    Combine a list of [start, end] ranges so that any that overlap or touch become one range, using sorting and a single sweep.

    Greedy & Intervalsintervalssortinggreedyarrays
  • 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 & IntervalsEasyAuto-graded
    Minimum Days to Complete Sequential Tasks With Daily Time Budgets

    Greedy single-pass simulation: pack tasks in order into daily time budgets without splitting, and return the day count or -1 if impossible.

    Greedy & Intervalsgreedysimulationtwo-pointersarrays
  • Greedy & IntervalsMediumAuto-graded
    Room Count and Heaviest Prerequisite Chain for Sessions

    Combine an interval-overlap sweep with a min-heap and a longest weighted path on a DAG using topological order.

    Greedy & Intervalsintervalsmin-heaptopological-sortdag
  • Greedy & IntervalsMediumAuto-graded
    Compute Free Windows from Schedule Constraints

    Compute unreserved time windows for specified daily schedules given opening hours and existing bookings.

    Greedy & Intervalsintervalssortingstringgreedy
  • 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 & IntervalsMediumAuto-graded
    Resolve Overlapping Text Edit Spans by Priority

    Sweep over span boundaries with a heap to resolve overlapping inclusive edit spans using priority, original length, and input order, splitting losers into fragments.

    Greedy & Intervalsintervalssweep-lineheaptie-breaking
  • Greedy & IntervalsMediumAuto-graded
    Consolidate Overlapping Bookings in a Weekly Schedule

    Parse weekday and 24-hour time strings, then merge touching or overlapping same-day bookings and output them in a canonical, sorted string format.

    Greedy & Intervalsintervalssortingstring-parsingmerge-intervals
  • 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 & IntervalsMediumAuto-graded
    Subscription Windows: Purchase Attribution and Anomaly Report

    Merge each user's subscription intervals, then attribute purchases to the merged windows, count September active days, and report out-of-window and overlap anomalies.

    Greedy & Intervalsintervalsmerge-intervalshash-mapdatetime
  • Greedy & IntervalsEasyAuto-graded
    Maximum Affordable Items Within Budget

    Determine the maximum collection of items that can be purchased given individual item costs and a total spending limit.

    Greedy & Intervalsgreedysortingarrays
  • Greedy & IntervalsEasyAuto-graded
    Find Peak Event Density in Fixed Duration Window

    Determine the maximum number of recorded logs occurring within a contiguous time interval using a sliding window approach.

    Greedy & Intervalssliding-windowtwo-pointersarraysintervals
  • Greedy & IntervalsMediumAuto-graded
    Weekly Deploy Windows with Time Zones and Blackouts

    Convert weekly recurring allow and freeze windows from local time zones to UTC, subtract the freezes, and list the first usable slots after a notice period.

    Greedy & Intervalsintervalssweep-linetime-zonesmodular-arithmetic
  • Greedy & IntervalsMediumAuto-graded
    Metered Usage Bill with Special Rate Windows

    Compute a total bill over a half-open time window where disjoint special-rate windows replace the default hourly rate, testing interval clipping and boundary handling.

    Greedy & Intervalsintervalssweepmatharrays
  • Greedy & IntervalsMediumAuto-graded
    Analyze Schedule Capacity and Overlaps

    Evaluate interval concurrency to determine if single-resource scheduling is possible and calculate peak concurrent demand.

    Greedy & Intervalsintervalssortingheapsweep-line
  • 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 & IntervalsMediumAuto-graded
    Insert and Merge Interval into Sorted Collection

    Incorporate a target range into an already sorted list of disjoint closed intervals, merging any overlapping or adjacent spans in linear time.

    Greedy & Intervalsintervalsarraysgreedy
  • Greedy & IntervalsMediumAuto-graded
    Find the Maximum Size Connected Interval Component

    Find the maximum number of intervals that belong to a single connected component where edges represent inclusive interval overlaps.

    Greedy & Intervalsintervalssortinggreedygraphs
  • Greedy & IntervalsEasyAuto-graded
    Split Chores Between Two Workers With a Fixed Quota

    Choose exactly k items for the first worker to maximize total payoff, which tests reducing a problem to per-item differences and greedy top-k selection.

    Greedy & Intervalsgreedysortingarraysexchange-argument
  • Greedy & IntervalsMediumAuto-graded
    Earliest Shared Free Slot Across Several Schedules

    Find the earliest meeting slot of a given length that fits inside everyone's availability window and avoids every busy block, by intersecting windows and merging busy intervals.

    Greedy & Intervalsintervalssweep-linesortingscheduling
  • Greedy & IntervalsMediumAuto-graded
    Merge Event Windows Within Each Locality

    Join two record lists by id, group event time ranges by locality, merge overlapping or touching ranges, and return the merged windows in a specified sort order.

    Greedy & Intervalsintervalsmerge-intervalshash-mapsorting
  • 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 & IntervalsMediumAuto-graded
    Minimum Removals for Conflict-Free Time Slots

    Tests the greedy earliest-finish strategy: find the fewest ranges to discard so the rest share no interior points, with touching endpoints allowed.

    Greedy & Intervalsgreedyintervalssortinginterval-scheduling
  • Greedy & IntervalsMediumAuto-graded
    Fewest Vehicles to Cover Back-to-Back Bookings

    Find the peak number of simultaneously active half-open intervals using a sweep line or heap, with correct handling of ties where one booking ends as another begins.

    Greedy & Intervalsintervalssweep-linesortingheap
  • Greedy & IntervalsMediumAuto-graded
    Sequential Allow/Deny Rules Over an IPv4 Block

    Track an IPv4 block as disjoint integer intervals while applying ordered allow and deny CIDR rules, deciding whether the block ends up fully covered with no deny hit.

    Greedy & Intervalsintervalsipv4cidrsimulation
  • Greedy & IntervalsMediumAuto-graded
    Courier Earnings from Overlapping Order Events

    Sweep over unsorted start/end events to total concurrency-weighted seconds, validate malformed input, and convert to a half-up rounded dollar string.

    Greedy & Intervalsinterval sweepevent sortingvalidationexact arithmetic
  • Greedy & IntervalsMediumAuto-graded
    Emptying Depots With a Limited Pool of Partner Skips

    Compute the minimum skips each depot needs using modular arithmetic, then greedily pick the cheapest depots under a shared skip budget to maximize emptied depots.

    Greedy & Intervalsgreedymathsortingmodular-arithmetic
  • Greedy & IntervalsEasyAuto-graded
    Best Single Buy-Sell Gain from Daily Quotes

    Find the largest gain from buying on one day and selling on a later day in a list of daily prices, returning 0 if no gain is possible.

    Greedy & Intervalsgreedyarraysrunning-minimumsingle-pass