Loading...
Given a stream of integers and a window size k, calculate the moving average of the last k values each time a new value arrives.
You will receive the window size and a sequence of values. For each value, output the moving average with 2 decimal places.
3 1,10,3,5
1.00 5.50 4.67 6.00
k is set to 3, and the first value 1 arrives, so the moving average is 1.00=11.