Code
The highlighted line runs next. The pill shows the live values in the running call.
Cost
Work done so far, and how the two solutions compare
The highway
Number on each car = its speed; colour = its fleet
The highlighted line runs next. The pill shows the live values in the running call.
Work done so far, and how the two solutions compare
Number on each car = its speed; colour = its fleet
Keyboard: ← → step, Space play or pause. target 1–100, up to 8 cars with different positions (0 ≤ position < target) and speeds 1–20. A car that reaches its leader exactly at the target still counts as part of that fleet, which is why the test is ≤, not <.