KatInterview

Topic

Greedy & Intervals interview problems

Scheduling, interval merging and exchange arguments. 181 original problems, each with hidden test cases you can run in the browser.

Problems181

24 easy144 medium13 hard

Showing 121–150 of 181 results

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

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

    Model answergreedybinary-searchmathoptimization
  • 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.

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

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

    Auto-gradedgreedyarraystwo-pointers
  • 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.

    Auto-gradedintervalssortinggreedyarray
  • Tests interval merging with sorting, overlapping logic, and immutability constraints

    Auto-gradedintervalssortinggreedyarrays
  • 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.

    Auto-gradedarraysgreedytwo-pointers
  • Tests interval reasoning, array traversal, edge case handling with boundaries, and formatting output for missing number ranges.

    Auto-gradedarraysintervalsedge-cases
  • Tests interval merging logic, correctly handling touching boundaries, nested ranges, and producing sorted disjoint output.

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

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

    Auto-gradedintervalsbinary-searchhashingsorting
  • Tests interval merging and coverage detection with streaming data updates.

    Auto-gradedintervalsmerge-intervalsdata-structuresstreaming
  • 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.

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

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

    Auto-gradedintervalssweep-linegreedysorting
  • 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.

    Auto-gradedgreedysortingbounded-knapsack
  • Tests modular arithmetic insight and greedy reasoning to determine which resources are reachable under constrained movement rules.

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

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

    Auto-gradedgreedydynamic-programmingarrays
  • Tests whether a venue is open at a given weekday and time, handling multiple daily windows, overnight shifts, and week-boundary wraparound.

    Auto-gradedintervalssimulationboundary-conditions
  • Tests ability to sort intervals and merge adjacent or overlapping ranges into a minimal disjoint set.

    Auto-gradedarrayssortinggreedy
  • Tests interval overlap detection using sweep-line or heap techniques to find the maximum number of simultaneously active tasks.

    Auto-gradedintervalssortingheapsweep-line
  • Tests whether a candidate can use sweep-line event counting to locate the smallest integer covered by the greatest number of closed intervals.

    Auto-gradedsweep-lineintervalsdifference-array
  • Tests the classic greedy exchange-argument insight: sort jobs by deadline to maximise the number of unit-length jobs completed before their deadlines.

    Auto-gradedgreedyintervalssorting
  • Tests greedy two-pointer technique on sorted arrays to maximize disjoint pairs meeting a sum condition.

    Auto-gradedtwo-pointersgreedysorting
  • Tests greedy scheduling with frequency counting to compute minimum execution time under per-task-type cooldown constraints.

    Auto-gradedgreedyfrequency-countingscheduling
  • Tests greedy two-pointer coordination and integer division to equalize values with minimal movement.

    Auto-gradedgreedytwo-pointersmathsimulation
  • Tests whether you can compute the minimum number of item relocations to rebalance inventory across four warehouse zones using surplus/deficit reasoning.

    Auto-gradedgreedyarraysoptimization
  • Tests interval merging through sorting and linear scanning, focusing on edge-case handling for touching and nested ranges.

    Auto-gradedintervalssortingarrays

More topics