dp of length budget + 1 with all elements set to 0.i from 0 to n - 1.j from budget down to the cost of the current stock present[i].future[i] > present[i]), update dp[j] to be the maximum of dp[j] and dp[j - present[i]] + future[i] - present[i].dp[budget] as the maximum profit.