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
Create a free account to see the full worked solution and track your progress.
Interview format: Hedge Fund Quant, Prop Trading