FunctionRacerProblemsRace

Deepest Fall From a High

MediumNumPyPython

On each day, the fall is how far the price sits below the highest price so far, as a share of that high: (high - price) / high. Return the largest fall over all days.

Example 1

prices [100,120,90,110,60,130]
returns 0.5

The high is 120 when the price falls to 60: (120 - 60) / 120 is 0.5.

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