Stream Moving Average with Recent-Value Weighting

Asked at Atlassian · Coding Questions · Difficulty: Medium · Last asked Mar 20, 2023

Given a stream of numeric values and a window size, compute the moving average over the last N items. Follow-ups ask for a weighted moving average that emphasizes recent values and whether it can be done without storing all prior values.

Loading the problem…