prices[i] is a share price on day i. For every day i, report the best profit obtainable by buying on some day j <= i and selling on day i (buying and selling on the same day gives 0). Return the list of these per-day profits.
Examples
Input: prices = [7, 1, 5, 3, 6, 4]
Output: [0, 0, 4, 2, 5, 3]
Explanation: on day 4 the cheapest earlier price was 1, so 6 - 1 = 5.
Input: prices = [9, 8, 7]
Output: [0, 0, 0]
Constraints
1 <= len(prices) <= 10**50 <= prices[i] <= 10**6- Target complexity: O(n) time.
Goals
- Maintain the running minimum while scanning
- Produce one output per position