Algorithmic patterns · 13 / 15 Exercise Hard

Meeting rooms needed

Objective

To know how many meetings overlap at once, you create events (start +1, end −1), sort them by time and keep count of the active ones. The maximum is the number of rooms needed.

Instructions

  • The first line has the number n of meetings; then n lines start end. A meeting that ends at the same time another starts does not overlap with it.
  • Show Rooms needed: n.
Input
3
0 30
5 10
15 20
Output
Rooms needed: 2

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise