Record Highs
A day is a record high if its price is strictly higher than every price on all earlier days. The first day always counts. Return the number of record-high days in prices. Hint: np.maximum.accumulate.
Example 1
prices [3,1,4,4,6,2]
returns 3
Days 0 (3), 2 (4) and 4 (6) are records; the second 4 only ties.
Constraints
1 <= len(prices) <= 100
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Risk of a MixMedium
- Row SharesMedium
- Sort by First ColumnMedium
- Subtract Row MinimumMedium
- Unit VectorsMedium
- Best Square BlockHard
- Crossing AboveHard
- Current StreakHard