Additions in a naive moving average
You compute a -element moving average over an array of length the naive way - for each output window you re-sum all of its elements from scratch. Counting only the additions performed (a sum of numbers costs additions), how many additions does this take in total?
Show hints (2)+
- Number of windows ; each window-sum of elements costs additions.
- Total .
Answer
Reveal answer →Final answer
64
Want the full step-by-step worked solution? It's part of Premium - along with a worked solution for every question in the bank.
Asked at: Multi-Strategy Quant, Mixed Quant & Coding