Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Try thinking about the prefix before index k and the suffix after index k as two separate arrays.
Using two pointers or binary search, we can find the maximum prefix of each array where the numbers are less than or equal to a certain value