Implement a function to calculate the maximum profit from buying and selling stock given multiple transactions
HardProblem Statement
Implement a function to calculate the maximum profit from buying and selling stock given multiple transactions
Sample Input
[7, 1, 5, 3, 6, 4]
Sample Output
7
Limits
Time: 2s · Memory: 256 MB