End of Year Sale: Use Coupon Code END2025 to Get Extra 25% Off.
t1_cost to infinity and t1_profit to 0.t2_cost to infinity and t2_profit to 0.prices array.
a. Update t1_cost to be the minimum of the current t1_cost and the current price.
b. Update t1_profit to be the maximum of the current t1_profit and the current price minus t1_cost.
c. Update t2_cost to be the minimum of the current t2_cost and the current price minus t1_profit.
d. Update t2_profit to be the maximum of the current t2_profit and the current price minus t2_cost.t2_profit as the maximum profit that can be achieved with at most two transactions.