Ezvor
Interview prep & careers
Practice
Home
Problems
Study Lists
Progress
Leaderboard
Compiler
Career
Readiness
Roadmaps
Opportunities
Resources
AI Advisor
0
day streak
0
solved
Settings
Sign in
Toggle Sidebar
Ezvor
Interview prep & careers
Problem List
Run
Submit
Interview
Interview mode
0
00:00
Description
Editorial
Solutions
AI Coach
Submissions
Notes
2291. Maximum Profit From Trading Stocks
Medium
Array
Preparing judge…
LeetCode
Array
Dynamic 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].
Preparing judge…
Testcase
Test Result
Case 1
Input