First Day Over Limit
Return the index of the first value in readings that is strictly greater than limit. If no value is greater, return -1. Hint: np.argmax on a boolean array finds the first True, but be careful when there is none.
Example 1
readings [3,8,12,9]
limit 10
returns 2
The first reading above 10 is 12, at index 2.
Example 2
readings [1,2]
limit 5
returns -1
Nothing is above 5.
Constraints
1 <= len(readings) <= 100
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Full ColumnsEasy
- Good ColumnsEasy
- Group MaximumsEasy
- Is SortedEasy
- Is SymmetricEasy
- Largest GapEasy
- Latest PeakEasy
- Merge and SortEasy