~/boss / scale-market

One-pass max profit

The Dragon Market

Buy one scale, sell it on a later day. Find the best profit in one walk.

Loading the fight…

How to beat it

Walk the days once and carry two numbers: the cheapest price so far and the best profit so far. Each day, ask: if I sold today, what would I make? Today minus the cheapest. Beat the best? Keep it. Cheaper than the cheapest? That's your new buy day.

Now the real boss

Interviews ask for the code. Watch it run, then write it yourself, tested in Python, C++ or Java.

On your phone? Writing code is easier on a laptop: open bossfight.dev/problems/best-single-trade-profit there. Sign in with your email to keep your progress on every device.

More bosses

esc