You walk along a line of plants, watering each one. Your can holds a limited amount of water, and you must refill at position 0.
Hint 1: Simulate the process greedily; walk forward watering each plant. When your can runs out, you must walk back to refill.
Hint 2: Each refill trip costs 2×(current position) extra steps (walk back and return). Minimize refill trips by watering as many plants as possible per trip.