Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
For all elements to be greater than the threshold/length, the minimum element in the subarray must be greater than the threshold/length.
For a given index, could you find the largest subarray such that the given index is the minimum element?
Could you use a monotonic stack to get the next and previous smallest element for every index?