출처 : https://leetcode.com/problems/largest-local-values-in-a-matrix/
class Solution {
public int[][] largestLocal(int[][] grid) {
int[][] res = new int[grid.length - 2][grid.length - 2];
int max = 0;
int startCol = 0;
int startRow = 0;
for (int t = 0; t < (grid.length - 2) * (grid.length - 2); t++) {
for (int c = startCol; c < startCol + 3; c++) {
for (int r = startRow; r < startRow + 3; r++) {
if (max < grid[c][r]) {
max = grid[c][r];
}
}
}
res[startCol][startRow] = max;
max = 0;
startRow++;
if (startRow == grid.length - 1 - 1) {
startCol++;
startRow = 0;
}
}
return res;
}
}