Tap here to switch tabs
Problem
Submissions

Problem: Number of Subarrays with Bounded Maximum

med
30 min
Try to solve the Number of Subarrays with Bounded Maximum problem.

Statement

Given an integer array nums and two integers left and right, return the number of contiguous non empty subarrays where the maximum element is greater than or equal to left and less than or equal to right.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 0≤0 \leq nums[i] ≤109\leq 10^9

  • 0≤0 \leq left ≤\leq right ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Subarrays with Bounded Maximum

med
30 min
Try to solve the Number of Subarrays with Bounded Maximum problem.

Statement

Given an integer array nums and two integers left and right, return the number of contiguous non empty subarrays where the maximum element is greater than or equal to left and less than or equal to right.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 0≤0 \leq nums[i] ≤109\leq 10^9

  • 0≤0 \leq left ≤\leq right ≤109\leq 10^9