Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Perform image convolution for a simple kernel on a grayscale image matrix.

Hard

Problem Statement

Perform image convolution for a simple kernel on a grayscale image matrix.

Sample Input

Matrix: [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; Kernel: [[0, -1, 0], [-1, 4, -1], [0, -1, 0]]

Sample Output

Convolved Matrix:
0 0 4 
3 0 7 
16 11 22 

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
using System; class ImageConvolution { static void Main() { // Perform convolution of the matrix using the kernel } }
Log in or sign up to run or submit your code.Log inSign up
Input
Matrix: [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; Kernel: [[0, -1, 0], [-1, 4, -1], [0, -1, 0]]
Expected Output
Convolved Matrix:
0 0 4 
3 0 7 
16 11 22