2426. Maximum Profit From Trading Stocks

Medium
Array
Dynamic Programming

Description

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].

Statistics

Acceptance
48.4%
Submissions
38,161
Accepted
18,465