(n - 2) x (n - 2) matrix called maxLocal to store the maximum values.n - 3 (inclusive).n - 3 (inclusive).(i, j), initialize a variable maxValue to store the maximum value found in the 3x3 submatrix.3x3 submatrix centered at (i + 1, j + 1) and update maxValue with the maximum value found.maxValue to maxLocal[i][j].maxLocal are filled.maxLocal matrix.