LC: 346. Moving Average from Data Stream - spiralgo/algorithms GitHub Wiki
346. Moving Average from Data Stream:
The Essence: The question tries to teach us:
- How to define a class.
- How to keep track of incoming numbers.
Details:
- It would be better for the problem-solver to learn how to create a class in the programming language of choice before starting the solution.
- We can keep track of incoming numbers using an
ArrayorList. To make it more efficient, we can use aDequeas we just need to keep track of numbers by givensize.