The extra minute
transcript
Robots spread from a dock. You count the minutes, ring by ring. The answer is one too high. Here is why.
A dock, then two open bays. Minute one reaches the first open bay. Minute two reaches the last bay. The answer should be two.
The code processes one ring. Then it adds a minute. It adds one even for an empty ring.
Read the length of the queue. Process exactly that many cells. Then count one minute, but only if the next ring has cells.
It counts three minutes. The right answer is two.
Test a floor with a single dock. Test a floor with no open bay. Then test a row that is blocked.
Do not add a minute every time. Add one only if the next ring has cells.
Take one ring at a time. Check that the next ring has cells first. Test a single dock. Full breakdown in the lecture.