06.15 · Problem
Buy Low, Sell High, Many Times
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
Item 69 of 94 · updated 2026-10-12