✅Easiest Solution🔥||Beat 100%🔥||Beginner Friendly✅🔥
Intuition\nThe code aims to find the largest local value within a 3x3 grid for each position (excluding the border) in the input grid.\nIt iterates through each
# Intuition\nThe code aims to find the largest local value within a 3x3 grid for each position (excluding the border) in the input grid.\nIt iterates through each position in the input grid, calculates the maximum value within the corresponding 3x3 subgrid, and stores it in the output array maxl.\n\n# Complexity\n- Time complexity:\n$$O(n^2)$$\n\n- Space complexity:\n$$O(n^2)$$\n\n# Code\n```\nclass Solution {\n    public int[][] largestLocal(int[][] grid) {\n\n        int n = grid.length;\n        int m = n-2;\n\n        int [][]maxl = new int [m][m];\n        int max = 0;\n\n        for(int i = 0; i<m;i++)\n        {\n            for(int j = 0 ;j<m;j++)\n            {\n\n                max = 0;\n                for(int k = i;k<i+3;k++)\n                {\n                    for(int l = j;l<j+3;l++)\n                    {\n                        max = Math.max(max,grid[k][l]);\n                    }\n                }\n                maxl[i][j] = max;\n\n            }\n        }\n        \n    return maxl;\n    }\n}\n```
['Array', 'Matrix', 'Java']