Quant Memo
Coding/●●●●●

Largest product of three daily returns

From a list of daily returns (which may be negative), choose three whose product is as large as possible. Watch out: two large negative returns multiply to a large positive, which can beat the three largest positives.

returns = [-10, -9, 1, 2, 3]
-> 270          # (-10) * (-9) * 3

Return the maximum product of any three elements. Aim for O(nlogn)O(n \log n) or O(n)O(n).

Your answer

This one is open-ended. Work it through, then check your reasoning against the full solution.

More Coding questions