🍁 C++ || 2 SOLUTION || EASY 🍁
//SOL 1\n\n\t\tint m(vector>& grid, int row, int col) {\n\t\tint ret = 0;\n\t\tret = max(ret, grid[row][col]);\n\t\tret = max(ret, grid[row][col + 1]);\n\t\tret
//SOL 1\n\n\t\tint m(vector<vector<int>>& grid, int row, int col) {\n\t\tint ret = 0;\n\t\tret = max(ret, grid[row][col]);\n\t\tret = max(ret, grid[row][col + 1]);\n\t\tret = max(ret, grid[row][col + 2]);\n\t\tret = max(ret, grid[row + 1][col]);\n\t\tret = max(ret, grid[row + 1][col + 1]);\n\t\tret = max(ret, grid[row + 1][col + 2]);\n\t\tret = max(ret, grid[row + 2][col]);\n\t\tret = max(ret, grid[row + 2][col + 1]);\n\t\tret = max(ret, grid[row + 2][col + 2]);\n\t\treturn ret;\n\t}\n\n\tclass Solution {\n\tpublic:\n\t\tvector<vector<int>> largestLocal(vector<vector<int>>& grid) {\n\t\t\tint n = grid.size();\n\t\t\tvector<vector<int>> ret(n - 2, vector<int>(n - 2));\n\n\t\t\tfor (int i = 0; i < n - 2; ++i) {\n\t\t\t\tfor (int j = 0; j < n - 2; ++j) {\n\t\t\t\t\tret[i][j] = m(grid, i, j);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n\t};\n\n//SOL 2\n\n\n\tclass Solution {\n\tpublic:\n\t\tvector<vector<int>> largestLocal(vector<vector<int>>& grid) {\n\t\t\tint m = grid.size(), n = grid[0].size(); \n\t\t\tvector<vector<int>> ans(m-2, vector<int>(n-2)); \n\t\t\tfor (int i = 1; i < m-1; ++i) \n\t\t\t\tfor (int j = 1; j < n-1; ++j) {\n\t\t\t\t\tint cand = 0; \n\t\t\t\t\tfor (int ii = i-1; ii <= i+1; ++ii) \n\t\t\t\t\t\tfor (int jj = j-1; jj <= j+1; ++jj) \n\t\t\t\t\t\t\tcand = max(cand, grid[ii][jj]); \n\t\t\t\t\tans[i-1][j-1] = cand; \n\t\t\t\t}\n\t\t\treturn ans; \n\t\t}\n\t};\n
['C', 'C++']