Ezvor

2291. Maximum Profit From Trading Stocks

MediumArray Preparing judge… LeetCode
ArrayDynamic Programming

Hints

Hint 1
Think of the 0-1 Knapsack Problem.
Hint 2
For the ith stock, the weight is present[i], and the value is future[i] - present[i].