Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Can you get the max/min of a certain subarray by using the max/min of a smaller subarray within it?
Notice that the max of the subarray from index i to j is equal to max of (max of the subarray from index i to j-1) and nums[j].