FunctionRacerProblemsRace

Record Highs

MediumNumPyPython

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

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More NumPy problems