PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates proficiency with interval scheduling, time-format conversion, and constraint checking for sequential appointments, measuring algorithmic reasoning and attention to edge cases.

  • medium
  • Mavenclinic
  • Coding & Algorithms
  • Software Engineer

Check Meeting Attendance With Breaks

Company: Mavenclinic

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given a list of appointment intervals for a single day and a mandatory break time between any two consecutive appointments. Each interval is represented as `[start, end]`, where `start` and `end` are times in 24-hour `HHMM` format, ranging from `0000` to `2359`. For example, `0930` means 9:30 AM and `1745` means 5:45 PM. Assume all appointments occur within the same day and no appointment crosses midnight. Write a function: ```python def can_attend_appointments(intervals, break_time=0): pass ``` The function should return `True` if a person can attend all appointments, and `False` otherwise. Requirements: - Appointments must not overlap. - After one appointment ends, the person must have at least `break_time` minutes before the next appointment starts. - If `break_time = 0`, only normal non-overlap is required. - You may need a helper function to convert `HHMM` time into minutes since midnight. Example: ```python intervals = [["0900", "1000"], ["1015", "1100"], ["1130", "1200"]] break_time = 15 ``` Return `True`, because there are at least 15 minutes between consecutive appointments. ```python intervals = [["0900", "1000"], ["1005", "1100"]] break_time = 10 ``` Return `False`, because there are only 5 minutes between appointments.

Quick Answer: This question evaluates proficiency with interval scheduling, time-format conversion, and constraint checking for sequential appointments, measuring algorithmic reasoning and attention to edge cases.

You are given a list of appointment intervals for a single day and a mandatory break time between any two consecutive appointments. Each interval is represented as [start, end], where start and end are strings in 24-hour HHMM format, from "0000" to "2359". For example, "0930" means 9:30 AM and "1745" means 5:45 PM. Appointments may be given in any order. Return True if a person can attend all appointments, and False otherwise. A person can attend all appointments only if no appointments overlap and there are at least break_time minutes between the end of one appointment and the start of the next appointment. If break_time is 0, appointments only need to be non-overlapping.

Constraints

  • 0 <= len(intervals) <= 100000
  • Each interval has exactly two strings: start and end
  • Each time is a valid HHMM string from "0000" to "2359"
  • For every interval, start < end and the appointment does not cross midnight
  • 0 <= break_time <= 1440
  • Appointments may be provided in any order

Examples

Input: ([["0900", "1000"], ["1015", "1100"], ["1130", "1200"]], 15)

Expected Output: True

Explanation: The gaps are 15 minutes and 30 minutes, so both satisfy the required 15-minute break.

Input: ([["0900", "1000"], ["1005", "1100"]], 10)

Expected Output: False

Explanation: There are only 5 minutes between 10:00 and 10:05, which is less than the required 10-minute break.

Input: ([["1300", "1400"], ["1330", "1500"]], 0)

Expected Output: False

Explanation: The second appointment starts at 13:30 while the first appointment is still in progress.

Input: ([["1500", "1530"], ["0900", "0930"], ["1000", "1100"]], 30)

Expected Output: True

Explanation: After sorting by start time, the gap from 09:30 to 10:00 is exactly 30 minutes and the later gap is much larger.

Input: ([["0000", "0030"], ["0030", "0100"], ["2350", "2359"]], 0)

Expected Output: True

Explanation: With no required break, an appointment may start exactly when the previous one ends.

Input: ([], 10)

Expected Output: True

Explanation: With no appointments, there are no conflicts.

Input: ([["0900", "1000"], ["0900", "1000"]], 0)

Expected Output: False

Explanation: Duplicate appointments completely overlap, so they cannot both be attended.

Hints

  1. Convert each HHMM time into minutes since midnight so time differences are easy to compare.
  2. Sort the appointments by start time, then compare each appointment with the previous one.
Last updated: Jun 19, 2026

Related Coding Questions

  • Solve two interview coding problems - Mavenclinic (medium)
  • Reorder Search Results for Provider Diversity - Mavenclinic (medium)

Loading coding console...

PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.