Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 2079. Watering Plants
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).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.