readings. You are also given numbers lo and hi. A stretch of readings (a contiguous piece of the array) qualifies if its smallest reading is **exactly** lo and its largest is **exactly** hi.
Return the number of qualifying stretches. Stretches at different positions count separately, even if their contents match.readings=[4, 2, 6, 3, 7], lo=2, hi=6 → 4
The stretches [2, 6], [4, 2, 6], [2, 6, 3] and [4, 2, 6, 3] qualify. Any stretch containing 7 fails because its maximum exceeds 6.
readings=[3, 3, 3], lo=3, hi=3 → 6
Each of the 6 stretches has minimum and maximum both equal to 3.
readings=[5, 1, 5], lo=1, hi=4 → 0
readings=[4, 2, 6, 3, 7], lo=2, hi=6
4
Run checks the first 3 tests in your browser. Submit checks all 118 tests on the server, hidden ones included.