Dynamic Programming for Maximum Stock Profit: Single and Multiple Transactions
Valid for a single buy-sell cycle The problem asks for the maximum possible profit from one purchase and one sale. A dynamic programming approach tracks two states for each day: cash_with_stock[i]: the largest amount of cash achievable on day i while holding the stock. cash_without_stock[i]: the lar...