All problems
Additive Decomposition Remainder
Problem
Compute the remainder of an additive decomposition by subtracting the trend and seasonal components from the observed series at every position, that is, remainder[t] = series[t] - trend[t] - seasonal[t].
Return an empty list when the three inputs do not all have the same length.
Hint
The remainder is what the trend and seasonal pattern fail to explain.
Test cases
case 1
in: [[10,12,14],[11,12,13],[0,0,0]]
expected: [-1,0,1]
case 2
in: [[5,7,9],[5,7,9],[1,1,1]]
expected: [-1,-1,-1]
case 3
in: [[1,2],[1],[]]
expected: []
case 4
in: [[3,3],[3,3],[0,0]]
expected: [0,0]
Starter codePython
def additive_remainder(series, trend, seasonal):
# Your code here
pass4 test cases · run your code against them in the editor