Loading page…
Kestrel Freight must group the parcels on a loading belt by priority class, express, standard and economy, in one turn of the belt. Counting and writing back is correct but takes two turns. Three pointers grow the express block from the front and the economy block from the back, so every parcel is checked once: exactly n steps and O(1) extra memory.
Parcels wait on a Kestrel Freight loading belt.