LC 252 — Problem

Given an array of meeting time intervals where intervals[i] = [start_i, end_i], determine if a person could attend all meetings.

Input: intervals = 030,510,1520
Output: false
Input: intervals = 710,24
Output: true

Constraints: 0 ≤ intervals.length ≤ 10⁴ · 0 ≤ start_i < end_i ≤ 10⁶

Imagine you are a conference room scheduler. Eight meetings are booked for the same room today. Your job: figure out if any two meetings overlap — because a double-booking means someone gets locked out.

The brute-force approach: pick any two meetings, check if they overlap, repeat. How many pairs would you need to check for 8 meetings?

FIG. 1 — EIGHT MEETINGS, UNSORTED
— any pair could overlap —

Pick any two meetings on the timeline above and check if they overlap. You choose which pairs to investigate.