04 Try it yourself Interactive

Walk the cycles, then walk the tail

Set the two pipes, choose whether B fills or drains, and choose who goes first. The solver builds the cycle, divides to find the whole cycles, then walks the remaining slots in pattern order — stopping at the first slot that can actually finish the tank.

A 16 min, B 12 min, A first
cycle +7 · 13 3/4 minutes
Try A at 20 minutes with B draining in 6. The drain removes more in its minute than A brings in during its own, so the cycle total is negative and the solver refuses to give a time.
Press Next to work through it one step at a time.
Tank units
Per cycle
Units in
Time so far
step 0 / 0