FASTEST way with JAVA, 2ms(beasts 99.5%)
\n\n# Code\n\nclass Solution {\n    public int[][] largestLocal(int[][] grid) {\n        int n = grid.length;\n        int[][] ret = new int[n-2][n-2];\n       
\n\n# Code\n```\nclass Solution {\n    public int[][] largestLocal(int[][] grid) {\n        int n = grid.length;\n        int[][] ret = new int[n-2][n-2];\n        for(int a = 0; a < n-2; a++){\n            int[] first = grid[a];\n            int[] second = grid[a+1];\n            int[] third = grid[a+2];\n            for(int b = 0; b < n-2; b++){\n                int max = 0;\n                for(int c  = b; c < b+3; c++){\n                    max = Math.max(max, first[c]);\n                }\n                for(int d = b; d < b+3; d++){\n                    max = Math.max(max, second[d]);\n                }\n                for(int e = b; e < b+3; e++){\n                    max = Math.max(max, third[e]); \n                }\n                ret[a][b] = max;\n            }\n        }\n        return ret;\n    }\n}\n```
['Java']