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
47.6%
Submissions
34,958
Accepted
16,637