Given an integer array nums and an integer k, find the contiguous subarray of exactly k elements with the greatest average.
Return that maximum average.
Inputnums = [1, 12, -5, -6, 50, 3], k = 4
Output12.75
The four consecutive values [12, -5, -6, 50] have the largest sum, 51. Their average is 51 ÷ 4 = 12.75.
Inputnums = [5], k = 1
Output5
The only window contains 5, so its average is 5 ÷ 1 = 5.
1 ≤ k ≤ nums.length ≤ 100,000-10,000 ≤ nums[i] ≤ 10,000