Sponsored
Use these hints if you're stuck. Try solving on your own first.
Can we sort the array to help us solve the problem?
We can use dynamic programming to keep track of the maximum at each position.
Solve with full IDE support and test cases