Practice Image Smoother
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
An image smoother is a filter of the size 3 x 3 that can be applied to each cell of an image by rounding down the average of the cell and the eight surrounding cells (i.e., the average of the nine cells in the blue smoother). If one or more of the surrounding cells of a cell is not present, we do not consider it in the average (i.e., the average of the four cells in the red smoother). Given an m x n integer matrix img representing the grayscale of an image, return the image after applying the smoother on each cell of it.
Source: Image Smoother on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
img = [[1,1,1],[1,0,1],[1,1,1]]
[[0,0,0],[0,0,0],[0,0,0]]
# Example 2
img = [[100,200,100],[200,50,200],[100,200,100]]
[[137,141,137],[141,138,141],[137,141,137]]
Constraints
Related LeetCode Problems
Practice more problems similar to Image Smoother.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.