MEDIUMasked at 1 company

Watering Plants

A medium-tier problem at 80% community acceptance, tagged with Array, Simulation. Reported in interviews at Amadeus and 0 others.

Founder's read

Watering Plants is a medium-difficulty array and simulation problem that appears deceptively simple until you realize the greedy approach has a hidden cost. Amadeus has asked this, and at nearly 80% acceptance, it looks beatable. The trap: forgetting that a plant kills your can's water supply midway, forcing a trip back to refill, which burns extra steps. This is where candidates blank during live OAs. If you hit this problem cold and don't catch the refill mechanic, StealthCoder surfaces a working solution in seconds, invisible to the proctor.

Companies asking
1
Difficulty
MEDIUM
Acceptance
80%

Companies that ask "Watering Plants"

If this hits your live OA

Watering Plants is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE.

Get StealthCoder
What this means

The core trick is tracking water capacity while simulating a left-to-right or right-to-left walk. The naive pass just counts steps. But once your can empties before reaching the end, you backtrack, refill, and restart, adding hidden distance. The gotcha: students code the walk correctly but forget the turnaround penalty, submitting a solution that looks right but flails on cases where refill happens mid-sequence. You need to track remaining water and detect when it dips below what the next plant needs, triggering a reset to the source. The pattern is simple once you see it, but the simulation logic is error-prone. When you're under time pressure in an OA and the obvious loop isn't passing examples, StealthCoder cuts through the guesswork.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Watering Plants recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Watering Plants interview FAQ

Is Watering Plants still asked in OAs?+

Yes. Amadeus has asked it. The 80% acceptance rate suggests it's not rare, but it's not a FAANG staple either. It's the kind of problem that shows up in mid-tier company assessments where simulation and array handling matter.

What's the main trick I'm missing?+

The backtrack cost. Walking left to right and refilling at the start when your can empties adds extra steps. You must track remaining water and detect when you can't reach the next plant, then calculate the distance back and forward again.

How does this relate to dynamic programming or greedy?+

It's greedy and simulation, not DP. You walk in one direction, refill greedily when forced, and the optimal path is always backtrack-and-refill. No subproblem overlap; it's all about correct step counting and state tracking.

Will I blank on this in a live OA?+

Possibly. It looks straightforward until you code it and edge cases fail. The refill mechanic and distance recalculation trip up candidates who don't simulate carefully. That's where a real-time solution is a safety net.

What languages does this work in?+

It's language-agnostic. Python, Java, C++, JavaScript all handle it fine. The logic is the same: track position, water level, and refills. Language choice doesn't matter for this one.

Want the actual problem statement? View "Watering Plants" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.