Skip to content

Meeting Rooms II

MediumIntervals
Decode it first. Clues, constraints, pattern and plan before any code.

Each meeting is a pair [start, end]. Return the minimum number of rooms needed so that every meeting gets a room. A room freed at time 10 can be used by a meeting that starts at 10.

[[0, 30], [5, 10], [15, 20]]  →  2
[[7, 10], [2, 4]]             →  1
[[1, 5], [5, 10]]             →  1   (back to back shares a room)

Constraints

  • 0 <= intervals.length <= 10^4
  • 0 <= start < end <= 10^6