Sponsored
Sponsored
Solve with full IDE support and test cases
Use these hints if you're stuck. Try solving on your own first.
How can we use dynamic programming to solve the problem?
Let dp[i] be the answer to the subarray nums[0…i]. What are the transitions of this dp?