Java beats 100%
Java beats 100%\n\n\n\n\n# Code\n\nclass Solution {\n\n    public int largestLocalUtil(int[][] grid, int x, int y) {\n        int max = 0;\n        \n        fo
Java beats 100%\n\n![image.png](https://assets.leetcode.com/users/images/ec28448d-8e86-4030-a0bb-099121a05d2b_1715513837.842973.png)\n\n\n# Code\n```\nclass Solution {\n\n    public int largestLocalUtil(int[][] grid, int x, int y) {\n        int max = 0;\n        \n        for (int i = x ; i < x+3 ; i++) {\n            for (int j = y ; j < y+3 ; j++) {\n                max = Math.max(max, grid[i][j]);\n            }\n        }\n        \n        return max;\n    }\n    \n    public int[][] largestLocal(int[][] grid) {\n        int n = grid.length;\n        \n        int m = n-2;\n        \n        int[][] ans = new int[m][m];\n        \n        for (int i = 0 ; i < m ; i++) {\n            for (int j = 0 ; j < m ; j++) {\n                ans[i][j] = largestLocalUtil(grid, i, j);\n            }\n        }\n        \n        return ans;\n    }\n}\n```
['Java']