Best Time to Buy and Sell Stock II
Find the maximum profit from buying and selling stock with unlimited transactions. You may hold at most one share at a time.
Best Time to Buy and Sell Stock II

Find the maximum profit from buying and selling stock with unlimited transactions. You may hold at most one share at a time.

Example 1:
Input: [7,1,5,3,6,4]
Output: 7
Input
arr =[7,1,5,3,6,4]
7
i
Day 0
1
Day 1
5
Day 2
3
Day 3
6
Day 4
4
Day 5
Current Index
0
Current Gain
-
Total Profit
0
Transactions
0
Variables
No variables to display
DepthFunction Call
Stack empty
0/13