FastPrepMinimum Appointment Cancellations with a Required Break
Problems/Minimum Appointment Cancellations with a Required Break

Minimum Appointment Cancellations with a Required Break

Maven Clinic logoMaven Clinic● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Several Maven Clinic reports describe the HHMM meeting-overlap question. They also describe the follow-up with a required break and the follow-up about the fewest cancellations. The reports use conflicting words about which meetings are kept and which are removed, and they do not say how to break ties. We made both rules fixed. Our version is about 95% the same as the reported question.

You are given same-day appointments as [startHHMM, endHHMM] pairs and a required nonnegative break in minutes. Two kept appointments are compatible when the later appointment starts at least breakMinutes minutes after the earlier appointment ends.

Cancel the minimum number of appointments so that all remaining appointments are compatible. Return the cancelled appointments in their original input order.

When several maximum-size compatible schedules exist, keep the schedule produced by considering appointments in increasing end time, then increasing start time, then original input order.

Function

cancelAppointments(intervals: int[][], breakMinutes: int) → int[][]

Examples

Example 1

intervals = [[1000,1030],[1005,1010],[1115,1120]]breakMinutes = 5return = [[1000,1030]]

Keeping the appointment ending at 10:10 leaves room for the 11:15 appointment, so only the longer 10:00 appointment is cancelled.

Example 2

intervals = [[1400,1459],[1500,1530]]breakMinutes = 5return = [[1500,1530]]

The second appointment starts one minute after the first ends, which is less than the required five-minute break.

Example 3

intervals = [[900,930],[935,1000],[1010,1040]]breakMinutes = 5return = []

Every consecutive gap meets or exceeds five minutes, so nothing is cancelled.

Constraints

  • 0 <= intervals.length <= 100000.
  • Every time is a valid same-day 24-hour HHMM value.
  • Each appointment satisfies startHHMM < endHHMM after conversion to minutes.
  • 0 <= breakMinutes <= 1440.
  • No appointment crosses midnight.

More Maven Clinic interview questions

  • Shortest Currency Conversion with Three-Decimal RatePHONE SCREEN · Seen Mar 2026
  • Configurable Valid BracketsPHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2025
  • Meeting Rooms IIPHONE SCREEN · Seen Aug 2025
  • Possible BipartitionPHONE SCREEN · Seen Aug 2024
  • Paginate Provider Listings with Per-Page DiversityONSITE INTERVIEW · Seen Apr 2026
  • Longest Valid ParenthesesONSITE INTERVIEW · Seen Aug 2025

Similar questions at other companies

  • Minimum Removals for Non-Overlapping IntervalsByteDance · PHONE SCREEN · ONSITE INTERVIEWByteDance interview questions
  • Maximum Number of Events That Can Be AttendedSnowflake · PHONE SCREENSnowflake interview questions
  • Minimum Meeting RoomsSentry · PHONE SCREENSentry interview questions
  • Maximum Compatible Time WindowsIBM · OAIBM interview questions
  • Minimum Workers with Job AssignmentsLyft · ONSITE INTERVIEWLyft interview questions
  • Minimum Markers to Clear Line SegmentsHSBC · OAHSBC interview questions
  • Minimum Machines for TasksExpedia · OAExpedia interview questions
  • Minimum Removals for Non-Overlapping IntervalsBloomberg LP · ONSITE INTERVIEWBloomberg LP interview questions
  • Most Disjoint Intervals From Starts and DurationsDocuSign · OADocuSign interview questions
  • University Career FairRoblox · OARoblox interview questions
All Maven Clinic interview questionsSee Maven Clinic hiring insights
Saved
class Solution {
    public int[][] cancelAppointments(int[][] intervals, int breakMinutes) {
        // Write your code here.
    }
}
Checking account…