Given daily stock prices, you may complete as many transactions as you like (buy then sell, holding at most one share at a time). Return the maximum total profit. The input is JSON {prices}.
Input: JSON {prices}.
Output: Integer — the maximum total profit.
Input: {"prices":[7,1,5,3,6,4]}
Output: 7
Explanation: Profit 4 then 3.Input: {"prices":[1,2,3,4,5]}
Output: 4
Explanation: Buy day 1, sell day 5.Input: {"prices":[5]}
Output: 0
Explanation: No transaction.1<=n<=10^5