Available question text
Simulate greedily watering plants left-to-right with a fixed-capacity can starting at the river: whenever remaining water can't fully cover the next plant you must walk back to the river and return, so accumulate per-plant walking plus the extra round-trip distance to refill. The challenge is computing the total steps efficiently by tracking remaining water and adding 2*(i+1) distance whenever a refill is needed (O(n) time, O(1) space).
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 2079. Watering Plants
Interview date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source