Given an integer array price_sequence where price_sequence[i] represents the price of a stock at time index i, compute the maximum possible profit by performing any number of buy and sell operations. You may buy and sell multiple times, but you can only hold at most one unit of stock at any time. You may buy and sell on the same day. Return the maximum achievable profit as an integer.
Example 1
Input: [2, 4, 1, 5, 3]
Output: 6
Explanation: Buy at 2, sell at 4 (profit 2), buy at 1, sell at 5 (profit 4), total profit 6.
Example 2
Input: [8, 7, 6, 5, 4]
Output: 0
Explanation: Prices decrease, no profit possible.
Example 3
Input: [3, 3, 3, 3, 3]
Output: 0
Explanation: No price change, no profit possible.
Constraints
Case 1
Input: [1, 3, 2, 6, 4, 7]
Expected: 9
Case 2
Input: [5, 2, 8, 1, 3]
Expected: 8
Case 3
Input: [10, 9, 8, 7, 6, 5]
Expected: 0
Case 4
Input: [1, 2, 1, 2, 1, 2]
Expected: 3