A brute-force algorithm will calculate the sum of every 5-element contiguous subarray of the given array and divide the sum by ‘5’ to find the average.
Table of contents
Coding Interview Made Easy: Understanding the Sliding Window PatternBrute-force algorithmSliding Window to the rescueSort: