mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-04-29 12:16:14 -04:00
Update moving_average.py
This commit is contained in:
parent
db7be11ea0
commit
af264699b7
@ -3,17 +3,13 @@
|
||||
# author: bt3gl
|
||||
|
||||
'''
|
||||
Given a stream of integers and a window size, calculate the moving average of all integers in the sliding window.
|
||||
|
||||
Implement the MovingAverage class:
|
||||
|
||||
MovingAverage(int size) Initializes the object with the size of the window size.
|
||||
double next(int val) Returns the moving average of the last size values of the stream.
|
||||
Given a stream of integers and a window size, calculate the moving average in the sliding window.
|
||||
'''
|
||||
|
||||
class MovingAverage:
|
||||
|
||||
def __init__(self, size: int):
|
||||
|
||||
self.queue = []
|
||||
self.size = size
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user