Java Clean Solution | Daily Challanges
Complexity\n- Time complexity:O(n^3)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:O(r*c)\n Add your space complexity here, e.g. O(n) \n\n# 
# Complexity\n- Time complexity:$$O(n^3)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:$$O(r*c)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    private int helper(int[][] grid, int i, int j) {\n        int maxi = Integer.MIN_VALUE;\n        int r = i + 3, c = j + 3;\n        for (int p = i; p < r; p++) {\n            for (int q = j; q < c; q++) {\n                maxi = Math.max(maxi, grid[p][q]);\n            }\n        }\n        return maxi;\n    }\n\n    public int[][] largestLocal(int[][] grid) {\n        int r = grid.length - 2;\n        int c = grid[0].length - 2;\n\n        int[][] res = new int[r][c];\n        for (int i = 0; i < r; i++) {\n            for (int j = 0; j < c; j++) {\n                res[i][j] = helper(grid, i, j);\n            }\n        }\n        return res;\n    }\n}\n```
['Array', 'Matrix', 'Java']