Java easy solution, 100% faster (2 ms)
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(n^2)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n   public int[][] largestLocal(int[][] grid) {\n        int n = grid.length;\n        int[][] ans = new int[n - 2][n - 2];\n        for (int i = 0; i < n - 2; i++) {\n            for (int j = 0; j < n - 2; j++) {\n                ans[i][j] = getMax(grid, i+1, j+1);\n            }\n        }\n        return ans;\n    }\n\n    private int getMax(int[][] grid, int i, int j) {\n        int max = grid[i][j];\n        max = Math.max(max, grid[i][j - 1]);\n        max = Math.max(max, grid[i - 1][j - 1]);\n        max = Math.max(max, grid[i - 1][j]);\n        max = Math.max(max, grid[i - 1][j + 1]);\n        max = Math.max(max, grid[i][j + 1]);\n        max = Math.max(max, grid[i + 1][j + 1]);\n        max = Math.max(max, grid[i + 1][j]);\n        max = Math.max(max, grid[i + 1][j - 1]);\n        return max;\n    }\n}\n```
['Java']