Leetcode 795. Number of Subarrays with Bounded Maximum
Count the number of contiguous subarrays whose maximum element lies in the inclusive range [left, right]. Solve efficiently with a linear scan by counting subarrays with max ≤ right minus those with max < left (i.e., sliding-window/segment counting).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.