Skip to content
DeepForgeby svx
All problems
EasyTime Seriests-091

Intermittent Demand Check

Problem

Return True when the share of zero observations in a series is at least threshold, which flags intermittent demand that standard smoothing handles poorly.

An empty series returns False.

Hint

Count zeros, divide by the length, compare to the threshold.

Test cases

case 1
in: [[0,5,0,7],0.5]
expected: true
case 2
in: [[1,2,3],0.1]
expected: false
case 3
in: [[0,0,0],1]
expected: true
case 4
in: [[],0.3]
expected: false
Starter codePython
def intermittent_demand_check(series, threshold):
    # Your code here
    pass

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