Number of Subarrays with Bounded Maximum

Number of Subarrays with Bounded Maximum - Coding Problem | K5kC