Not sure what to study next?

Get a personalised quant interview roadmap built around your upcoming interviews, strengths and weaknesses.

Takes a few minutes. Start with your target role and firms.

← Programming questions
Medium / PYTHON

Maximum Drawdown

arrays · running_extrema · finance 20 minute study target

Not completed

Challenge

Implement maximum_drawdown(prices) for a list of strictly positive prices. Return the largest percentage fall from an earlier peak to a later price, rounded to two decimal places. An empty or single-price list returns 0.0. Compute 100 * (peak - price) / peak, with the peak taken only from the prices seen so far. Aim for O(n). For [100,80,120,90,110,70], return 41.67.

Target complexity: O(n)

Return values are checked by type. Use the exact function name. Print output is not your answer. Tests have time and memory limits.

Public examples

Example 1

Arguments

[[100, 80, 120, 90, 110, 70]]

Expected return

41.67
Example 2

Arguments

[[50, 60, 70, 80, 90, 100]]

Expected return

0.0
Hint

Track the largest price seen so far.

The worked solution unlocks after completion, or with Premium access.

maximum_drawdown.pyPython 3.12

Drafts are saved to your account, not to shared browser storage.

Sign in to submit code and save progress.

Results

Your results will appear here.

Hidden tests reveal only their pass/fail status, never their inputs or expected outputs. Runtime is observed wall time—not an inferred complexity class.

Join our Newsletter and Receive the Latest Updates!

Main Links

Trade Courses Assessments Interview Prep Contact Us

Social Media

Facebook Instagram YouTube

Legal

Terms and Conditions Privacy Policy Privacy settings

Talent Acquisition

Looking to hire exceptional quant talent?
See how we can help.

© 2026 EverythingQuant. All Rights Reserved.