</>OfferRetriever
DashboardDiscuss
NEW

Spring Hire Sale

Limited Time Deal: Unlock all premium questions for over 30% off

$10.42$7.08

08

:

04

:

54

:

33

Get this deal
Back to Dashboard

[CodeSignal] Round-Robin Package Dispatcher

Hard

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. ...