CodePark/ problems / Can You Attend Every Meeting?
START PRACTICINGPRACTICE
Coding problem · Data structures and algorithms › Sorting and intervals

Can You Attend Every Meeting?

easyabout 10 minutes in an interview

Each meeting is [start, end], with start < end. Check whether one person can go to every meeting on the list without being in two places at once. Return true if no two meetings overlap, and false if any do.

  • Back-to-back is fine: a meeting may end at the exact moment the next one begins. So [9, 10] and [10, 12] don't clash.
  • The meetings are not sorted.
  • An empty list gives true. The list can hold up to 100,000 meetings.
Input: meetings = [[9, 10], [13, 14], [10, 12]] Output: trueIn time order: 9–10, 10–12, 13–14. The first two only touch.
Input: meetings = [[1, 5], [8, 9], [3, 7]] Output: false1–5 and 3–7 both cover the time from 3 to 5.