Given daily prices of a stock, you may complete at most one transaction (buy once and sell once, buying before selling). Return the maximum profit, or 0 if none is possible. The input is JSON {prices}.
Input: JSON {prices}.
Output: Integer — the maximum profit.
Input: {"prices":[7,1,5,3,6,4]}
Output: 5
Explanation: Buy at 1, sell at 6.Input: {"prices":[7,6,4,3,1]}
Output: 0
Explanation: Prices only fall.Input: {"prices":[1]}
Output: 0
Explanation: No transaction possible.1<=n<=10^5