Prototype: RoomCalendar.reserve(start,end) requires safe integers start>=0 and end>start, returns false for any overlap and true for accepted half-open interval. slots returns fresh start/end-sorted [start,end] pairs.

Final: MeetingRoomBooking(rooms) copies plain {roomId:capacity} object; nonempty IDs/positive integer capacities, empty valid. book(bookingId,start,end,seats,roomCount=1) validates nonempty ID, interval, positive seats/count before duplicate checks. Each selected room independently holds seats. Choose exactly roomCount available rooms by capacity then ID, commit together, return IDs in selection order or null unchanged. Successful IDs stay reserved forever, including after cancel. cancel returns true once and frees all assignments. allocation returns fresh original IDs or null. schedule(roomId) rejects unknown room and returns fresh {id,start,end,seats} records sorted start/end/ID. No clock/cleanup/recurrence.

Every class is exported by name from exercise.mjs. Keep instances independent. Unless explicitly documented otherwise, input values have the stated collection/string types and do not contain null elements. Invalid calls preserve state; validate before mutation. Return fresh mutable snapshots unless stated otherwise.

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.