Given daily stock prices, return the maximum profit from at most one transaction. The sale must occur after the purchase; return 0 when no profitable trade exists.
Input / output
prices: integer[]Examples
[7,1,5,3,6,4] returns 5 by buying at 1 and selling at 6.[7,6,4,3,1] returns 0.Constraints
0 <= prices.length <= 100,0000 <= prices[i] <= 1,000,000Follow-up
How would the state change for unlimited transactions or at most k transactions?