You want to water plants[i] units of water. You are given an integer array plants and an integer capacity representing the maximum capacity of your watering can.
You start at the river located at coordinate
Water the plants in order from left to right, starting at plant
Moving between adjacent coordinates takes
If your watering can contains enough water to fully water plant
If your watering can does not have enough water to fully water plant
You cannot refill your watering can unless you cannot completely water the current plant.
Return the total number of steps required to water all the plants.
Constraints:
n == plants.length
n
plants[i]
plants[i]capacity
You want to water plants[i] units of water. You are given an integer array plants and an integer capacity representing the maximum capacity of your watering can.
You start at the river located at coordinate
Water the plants in order from left to right, starting at plant
Moving between adjacent coordinates takes
If your watering can contains enough water to fully water plant
If your watering can does not have enough water to fully water plant
You cannot refill your watering can unless you cannot completely water the current plant.
Return the total number of steps required to water all the plants.
Constraints:
n == plants.length
n
plants[i]
plants[i]capacity