Count Subarrays With Fixed Bounds

Hard · Queue & Deque · about 25 minutes

Asked at Google, Amazon, Microsoft, Meta.

Count the contiguous slices of nums whose smallest value is exactly minK and whose largest value is exactly maxK.

Related guides