Maximum Average Subarray - Fixed Window

Maintain a running sum of kk elements. Slide the window by adding the new element and removing the old one.

1.1. Compute sum of first kk elements.

2.2. For each position from kk to n1n-1:

  • Add nums[i] (entering the window).
  • Subtract nums[i-k] (leaving the window).
  • Update max sum if needed.

3.3. Return max sum divided by kk.