Happy Plant Days
Easy · array
Maya has a fern on her windowsill and writes down how much water it gets each day. You are given a list water, where water[i] is the number of millilitres the fern received on day i.
The fern is happy on a day when it received at least need millilitres that day. Each day is judged on its own.
Return how many days the fern was happy. If the list is empty, return 0.
Examples
Example 1
Input: water = [200, 50, 300, 100, 250], need = 150
Output: 3
Days 0, 2 and 4 got 200, 300 and 250 millilitres, which are all at least 150.
Example 2
Input: water = [100, 100, 100], need = 100
Output: 3
Exactly 100 millilitres is enough, so every day counts.
Example 3
Input: water = [10, 20], need = 100
Output: 0
Constraints
- 0 <= len(water) <= 1000
- 0 <= water[i] <= 1000
- 1 <= need <= 1000