Problem
Given an array nums and a radius k, build an output array of the same length. For each index i, look at the `k` elements on each side of `i` plus nums[i] itself (that is 2k + 1 elements). If that range runs off either end of the array, the output at i is -1. Otherwise it is the average of those elements, rounded down to an integer (integer division).
Example 1
nums = [7, 4, 3, 9, 1, 8, 5, 2, 6], k = 3
Example 2
→ [-1, -1, -1, 5, 4, 4, -1, -1, -1]
Example 3
- Input
- nums = [8], k = 100000
- Output
- [-1]
Constraints
1 <= nums.length <= 10^50 <= nums[i], k <= 10^5