Overview
You can complete as many transactions as you like, but you must sell the stock before you buy again.
Loading...
Loading Curriculum...
Loading Subject...
Loading Topic...
Loading Lesson...
Loading Lab...
Maximize your profit by making as many transactions as you like (buy one and sell one share of the stock multiple times).
You can complete as many transactions as you like, but you must sell the stock before you buy again.
Instead of finding the overall maximum difference, we can simply add up all the positive differences between consecutive days.
If the price on day i is greater than the price on day i-1, we add the difference to our total profit.
Every increasing slope in the price chart contributes to our profit. We can capture the entire upward movement by simply adding daily positive changes.