Sponsored
Use these hints if you're stuck. Try solving on your own first.
Think of the 0-1 Knapsack Problem.
For the ith stock, the weight is present[i], and the value is future[i] - present[i].
Solve with full IDE support and test cases