Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 346. Moving Average from Data Stream
Design a data structure that, given a continuous stream of numbers and a fixed window size k, returns the moving average of the last k values each time a new value arrives. The challenge is to maintain the sliding window efficiently (constant-time update and query) while using only O(k) space.
Asked at:
Meta
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Late September, 2025
Meta
Senior
Early September, 2025
Meta
Senior
Early August, 2025
Meta
Senior
Variant: entire array available at once, sliding window
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.