Given an array of numbers nums and a window size k, return an array of the averages of each contiguous window of size k.
Round each average to 2 decimal places.
For example, given nums = [1, 3, 2, 6, -1, 4, 1, 8, 2] and k = 5:
Result: [2.2, 2.8, 2.4, 3.6, 2.8]
nums = [1, 3, 2, 6, -1, 4, 1, 8, 2], k = 5[2.2, 2.8, 2.4, 3.6, 2.8]nums = [4, 4, 4, 4], k = 2[4.0, 4.0, 4.0]nums = [10], k = 1[10.0]1 <= k <= nums.length <= 10^4-10^6 <= nums[i] <= 10^6Run your code to see results
Use Cmd+Enter to run