LeetCode
Number of Subarrays with Bounded Maximum
Click
here
for an explanation.