array-algorithms

MovingSum of list of integers

MovingSum of list of integers Question: I want to calculate the moving sum of a list of integers with a window of size 3. I have a class as such: class MovingSum: def __init__(self, window=3): self.window = window def push(self, nums: List[int]): pass def belongs(self, total) -> bool: pass I need to calculate the moving …

Total answers: 1