Valid subarray counting Iterate one endpoint and keep valid range for other Count subarrays with fixed bounds