Question
Given a stream of integers and a window size, calculate the moving average of all integers in the sliding window.
For example,
Explanation:
非常简单的题目,可以用queue或者arraylist或者array保存next的值。用一个sum存着总和,每次都计算一下平均值。
Given a stream of integers and a window size, calculate the moving average of all integers in the sliding window.
For example,
非常简单的题目,可以用queue或者arraylist或者array保存next的值。用一个sum存着总和,每次都计算一下平均值。