** Initialize your data structure here. */
(size int)
| 8 | |
| 9 | /** Initialize your data structure here. */ |
| 10 | func Constructor(size int) MovingAverage { |
| 11 | return MovingAverage{ |
| 12 | q: make([]int, 0), |
| 13 | size: size, |
| 14 | sum: 0, |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | func (this *MovingAverage) Next(val int) float64 { |
| 19 | if len(this.q) == this.size { |
no outgoing calls