Click4Ai

311.

Medium

Apply a median filter to an image. **Example:** A 3x3 image with pixel values [[1,2,3],[4,5,6],[7,8,9]] and a kernel size of 3. **Constraints:** Kernel size must be odd and greater than 1.

Test Cases

Test Case 1
Input: [[1,2,3],[4,5,6],[7,8,9]]
Expected: [[2,3,4],[4,5,6],[6,7,8]]
Test Case 2
Input: [[10,20,30],[40,50,60],[70,80,90]]
Expected: [[20,30,40],[40,50,60],[60,70,80]]
+ 3 hidden test cases