Problem 134 · Medium

Gas Station

One pass: reset start to i+1 whenever cumulative tank drops below zero; the net total decides feasibility.

Open the interactive visualisation