Skip to content
DeepForgeby svx
All problems
MediumTime Seriests-119

Rolling Kurtosis

Problem

Compute the rolling population excess kurtosis with window size k: mean((x - window_mean)^4) / variance^2 - 3.

Return an empty list if k is not positive or exceeds the series; windows with zero variance produce 0.0 by convention.

Hint

Excess kurtosis is 0 for a normal distribution and negative for light tails.

Test cases

case 1
in: [[1,2,3,4,5],3]
expected: [-1.5,-1.5,-1.5]
case 2
in: [[1,1,1,2,10],3]
expected: [0,-1.4999999999999993,-1.4999999999999996]
case 3
in: [[1,2,3],3]
expected: [-1.5]
case 4
in: [[5,5],2]
expected: [0]
Starter codePython
def rolling_kurtosis(series, k):
    # Your code here
    pass

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