Prototype: RoomCalendar.reserve(start,end) requires start>=0 and end>start; overlapping requests return false unchanged, touching intervals accepted. slots returns fresh start/end-sorted Interval values.

Final: MeetingRoomBooking copies a room-ID -> positive capacity map (nonempty IDs, empty catalog valid). book validates nonempty ID, valid nonnegative interval, seats>=1 and roomCount>=1 before duplicate checks; each chosen room independently holds seats. Choose exactly roomCount free rooms by capacity then ID, returning IDs in that order, or null atomically. Successful IDs are reserved forever. cancel releases all active rooms once; allocation returns a fresh original list or null. schedule rejects unknown room and returns active Reservation records sorted start/end/ID. No clock/cleanup.

The complete public API is in Exercise.java. All domain classes are public static nested classes of Exercise; construct them as new Exercise.ClassName(...). Do not implement a solution in the test runner. Each instance owns independent state. Unless explicitly allowed, null inputs are outside the domain. Failed operations leave state unchanged; validation happens before mutation.

Drag or use the arrow keys to resize. Home collapses the question; End collapses the editor. Enter or double-click resets the split.
Loading editor…
No results yet.

Complete the starter code, then run the checks.
Results and errors will appear here.

Java runs on this device with CheerpJ 4.3.