Largest Window Average

L3 Easy Sliding Window
Concept
A sliding window keeps a sum for a fixed-size range and, each step, subtracts the value that leaves and adds the value that enters — O(1) update per move.
Given an array nums and an integer k, return the largest average value of any contiguous subarray of length exactly k. You can assume 1 <= k <= nums.count.
Examples
▸ nums = [1, 12, -5, -6, 50, 3], k = 4
→ 12.75
▸ nums = [5], k = 1
→ 5
▸ nums = [-1, -2, -3], k = 2
→ -1.5
Progressive Hints
Hint 1 · Nudge
Only the sum matters while you slide; divide once at the very end.
Hint 2 · Plan
Sum the first k elements as your starting total. Slide the window by subtracting the outgoing element and adding the incoming one, tracking the biggest total you see. Return the best total divided by k.
Hint 3 · Approach
best = sum of the first k elements, s = same sum. For i from k onward: s = s - nums[i - k] + nums[i], and best = the larger of best and s. Return best / k.
Output
// Run your code to see the output here.