All problems
Walk-Forward Window Count
Problem
Count walk-forward windows: starting at initial, count windows while t + horizon <= n and advance t by step.
Return 0 if step <= 0 or horizon <= 0.
Hint
A window fits whenever its start plus horizon does not exceed the series length.
Test cases
case 1
in: [10,3,2,1]
expected: 6
case 2
in: [10,3,2,2]
expected: 3
case 3
in: [5,0,2,1]
expected: 4
case 4
in: [4,2,5,1]
expected: 0
Starter codePython
def walk_forward_count(n, initial, horizon, step):
# Your code here
pass4 test cases · run your code against them in the editor