Spring Hire Sale
Limited Time Deal: Unlock all premium questions for over 30% off
08
:
04
:
54
:
33
[CodeSignal] Round-Robin Package Dispatcher
A logistics platform assigns packages to processing stations in round-robin order. You are given stationCapacity (max packages each station can handle) and an operation log dailyLog where each entry is either "PACKAGE" (assign one package) or "CLOSE i" (permanently close station i, 0-indexed).
Packages are assigned starting from station 0 in round-robin order. When assigning a package, skip stations that are closed or already at capacity. If a complete round through all non-closed stations finds no available station (all are full), a reset occurs: all non-closed stations have their load cleared to 0, and assignment restarts from station 0. Closed stations remain closed after a reset. ...