Stock Exchange Losses puzzle discussion

I solved this in O(n) by looking for the lowest point in the values. Then I go back through the list and look for the highest value before it.

One can trivialy come up with a set of values where this algorithm doesn’t work. Is there a correct O(n) way to do it?

1 Like