Skip to content
DeepForgeby svx
All problems
EasyStatisticsst-296

Switchback Period Count

Problem

Return the number of complete switchback periods that fit in total_time: floor(total_time / (block_length + washout_length)). Return 0 for non-positive total_time or block_length or negative washout_length.

Hint

Each period consumes its block plus a washout.

Test cases

case 1
in: [100,10,5]
expected: 6
case 2
in: [30,10,5]
expected: 2
case 3
in: [14,10,5]
expected: 0
case 4
in: [100,0,5]
expected: 0
case 5
in: [25,10,5]
expected: 1
Starter codePython
def switchback_periods(total_time, block_length, washout_length):
    # Your code here
    pass

5 test cases · run your code against them in the editor