solulubeta
Sign in
Story Problems / Greedy
06.15 · Problem

Buy Low, Sell High, Many Times

Easy Add every upward step Pro

This problem is part of solulu Pro

You know a stock's price for each of the next n days. You may buy and sell any number of times, but you can hold at most one share at a time (you may sell and buy again on the same day). What is the maximum profit?

Lifetime ₹2,000 ₹1,000 · Beta offer
Mark this problem as solved when you are finished.

Item 69 of 94 · updated 2026-10-12