steps[i] is the count for day i. It rates every stretch of days consecutive days (all such stretches, which overlap) by the total number of steps T in it:
- if T < low, the person loses 1 point;
- if T > high, they gain 1 point;
- otherwise the score stays the same.
The score starts at 0. Return the final score; it may be negative.steps=[4, 9, 2, 8], days=2, low=10, high=12 → 1
Two-day windows: 4 + 9 = 13 > 12 gives +1, 9 + 2 = 11 is in range, and 2 + 8 = 10 is in range too (the bounds count). Total 1.
steps=[1, 0, 3], days=1, low=2, high=5 → -2
Each day on its own: 1 and 0 are below 2 (−2), 3 is in range. Total −2.
steps=[5, 5, 5], days=3, low=15, high=15 → 0
steps=[4, 9, 2, 8], days=2, low=10, high=12
1
Run checks the first 3 tests in your browser. Submit checks all 88 tests on the server, hidden ones included.