One meeting room, n meeting requests name start end. Accept as many meetings as possible; two meetings are compatible if one ends before or exactly when the other starts.
Write RoomBooking with a method schedule(meetings, comparator) that sorts by the comparator and greedily accepts every meeting compatible with the last accepted one. Try three greedy rules — earliest finish first, earliest start first, shortest first (ties by name) — and print each schedule.
For the input
6
Long 0 20
A 1 3
B 3 6
C 6 9
Short 2 4
D 9 12
the program prints
Earliest finish first: 4 meetings: A[1-3] B[3-6] C[6-9] D[9-12]
Earliest start first: 1 meetings: Long[0-20]
Shortest first: 4 meetings: A[1-3] B[3-6] C[6-9] D[9-12]
Earliest finish is never beaten: true