InterviewDB Question

Mado Average: Sliding Window Average with Variable Window Size

Question Details

Problem "Mado" (window in Japanese) average: given an integer array and an integer k, compute the moving average using a window of size k. Also implement a streaming version that processes one element at a time. Follow-ups How do you maintain O(1) per element in the streaming version using a deque and running sum? What happens to floating-point precision after many additions? How would you mitigate drift? Extend to a weighted moving average where recent elements have higher weight. How would you…

Full Details

🔒

Unlock all Decagon questions

Full insider details, leaked discussions, and candidate experiences.

Get full access — $100 a year, unlimited access

About This Question

This is a reported interview question from a decagon interview during the phone round.

It covers the following topics: Sliding Window, Phone, Coding, Queue, Arrays, Onsite .