A grayscale image is a grid of integers img. Blur it: every cell in the new grid becomes the
average of the original cell and all of its neighbours (up to eight, including diagonals) that lie
inside the image, rounded down. Cells outside the image are ignored, not treated as zero.
Examples
Input: img = [[1, 1, 1],
[1, 0, 1],
[1, 1, 1]]
Output: [[0, 0, 0],
[0, 0, 0],
[0, 0, 0]]
Explanation: the corner (0,0) averages 1,1,1,0 -> 3 // 4 = 0; the centre averages eight 1s and a 0 -> 8 // 9 = 0.
Input: img = [[100, 200, 100],
[200, 50, 200],
[100, 200, 100]]
Output: [[137, 141, 137],
[141, 138, 141],
[137, 141, 137]]
Constraints
1 <= rows, cols <= 100,0 <= img[r][c] <= 255- The input must not be modified.
Goals
- Average a cell with its existing 8-directional neighbours
- Use floor division and count only cells that exist