Tap here to switch tabs
Problem
Submissions

Problem: Number of Subarrays with Bounded Maximum

Number of Subarrays with Bounded Maximum counts contiguous, nonempty subarrays whose largest value falls between the given lower and upper bounds, inclusive.

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

Number of Subarrays with Bounded Maximum counts contiguous, nonempty subarrays whose largest value falls between the given lower and upper bounds, inclusive.

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