← 返回 bytedance 的题目列表Implement Moving Average from Data Stream
类型:online_judge
Implement a class that returns the moving average from a data stream. Implement the MovingAverage class with a constructor that takes an integer and a method next(int val). Each call to next should return the average of the numbers in the defined window size. Note that you may need to consider an efficient sliding window implementation.
Example
Input
3
1
10
3
5