📜  滑动窗口算法 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:33.179000             🧑  作者: Mango

代码示例2
def window(iterable, size=2):
    i = iter(iterable)
    win = []
    for e in range(0, size):
        win.append(next(i))
    yield win
    for e in i:
        win = win[1:] + [e]
        yield win