Meeting Rooms

Python data engineering interview problem. Difficulty: intermediate. Pattern: Intervals. About 14 minutes. Part of the Pro drill bank.

Whether a person can attend all meetings. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.

A person cannot attend two meetings that happen at the same time. Before accepting a calendar, compare each meeting with the one that ends just before it begins. Return True when every interval can be attended without overlap, and False as soon as two meetings share time. Sort by start time before comparing neighbours. Write the function can_attend_meetings(intervals: list) -> bool. [0, 30] overlaps both [5, 10] and [15, 20], so the first sample returns False. The starter file already has the function name and the harness print lines. Keep them, and fill only the function body.

Requirements

  • Compare meetings by their time ranges, not by input order.
  • Allow a meeting to start exactly when the previous one ends.
  • Return one boolean value.

Constraints

  • Each interval is [start, end] and the input may be unsorted.
  • The return type is bool; an empty list and a single interval are valid schedules.

Examples

Input: can_attend_meetings([[0, 30], [5, 10], [15, 20]]) Output: False All overlap the long meeting.

Topics: lakebench, python, meetings, overlap.

More Python interview questions · All interview problems · Learn data engineering

intermediate

Meeting Rooms

Interview-style drill: Whether a person can attend all meetings.

Implement `can_attend_meetings(intervals: list) -> bool`. Example: `[[0, 30], [5, 10], [15, 20]]` → `False`. Keep the harness.