Beginner friendly [Java/JavaScript] Solutuion
Java\n\nclass Solution {\n    int count = 2;\n    public int[][] largestLocal(int[][] grid) {\n        int n = grid.length;\n        int[][] arr = new int[n-1][
**Java**\n```\nclass Solution {\n    int count = 2;\n    public int[][] largestLocal(int[][] grid) {\n        int n = grid.length;\n        int[][] arr = new int[n-1][n-1];\n        for(int i=0; i<arr.length; i++){\n            for(int j=0; j<arr.length; j++){\n                arr[i][j] = Math.max(grid[i][j], Math.max(grid[i][j+1], Math.max(grid[i+1][j], grid[i+1][j+1])));\n            }\n        }\n        return --count == 0 ? arr : largestLocal(arr);\n    }\n}\n```\n**JavaScript**\n```\nvar largestLocal = function(grid, count = 2) {\n    let n = grid.length\n    let arr = []\n    for(let i=0; i<n-1; i++)    arr[i] = []\n    for(let i=0; i<arr.length; i++){\n        for(let j=0; j<arr.length; j++){\n            arr[i][j] = Math.max(grid[i][j], Math.max(grid[i][j+1], Math.max(grid[i+1][j], grid[i+1][j+1])))\n        }\n    }\n    return --count == 0 ? arr : largestLocal(arr, count)\n};\n```
['Java', 'JavaScript']