All problems
Windowing Count
Problem
Count supervised windows consisting of a lookback block followed by horizon target values: (n - lookback - horizon) // stride + 1.
Return 0 when any parameter is not positive or no full window fits in the series.
Hint
Both the lookback and the horizon must fit inside the series.
Test cases
case 1
in: [100,24,12,1]
expected: 65
case 2
in: [100,90,12,1]
expected: 0
case 3
in: [50,10,5,5]
expected: 8
case 4
in: [10,10,0,1]
expected: 0
Starter codePython
def windowing_count(n, lookback, horizon, stride):
# Your code here
pass4 test cases · run your code against them in the editor