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.3%
Submissions
36,983
Accepted
17,849