June 9, 2024 - Max Average Subarray - 643 The function has two loops. The first loop finds the sum of the initial subarray, beginning with index 0 to the index k. Rather than continuing to perform iterating operations to find future sums, the first sum is used in the second loop as a starting point. The previous index is subtracted, and the first index past i + k is added. The average is calculated and compared with the max for each iteration.