100% Fast Java.. Easy to Understand Full Explaination End to End
FULL CODE\n\n   public int[][] largestLocal(int[][] grid) {\n    int n = grid.length;\n       int [][] res = new int [n-2][n-2];\n       for(int i=0; i<n-2;i++)
# **FULL CODE**\n```\n   public int[][] largestLocal(int[][] grid) {\n    int n = grid.length;\n       int [][] res = new int [n-2][n-2];\n       for(int i=0; i<n-2;i++){\n           for(int j=0; j<n-2;j++){\n               res[i][j]= getMaxVal(i,j,grid);\n           }\n       }\n\treturn res;\n   \n   }\n\nint getMaxVal(int i, int j, int[][] grid)\n{\n    int Max = Integer.MIN_VALUE;\n    for(int a= i; a<=i+2; a++){\n        for(int b= j; b<=j+2; b++){\n            Max = Math.max(grid[a][b],Max);                              }\n    }    \n    return Max;\n}\n```\n# **EXPLAINATION**\n1. Initialize the empty array with size `n-2` or `grid.length-2`. i.e. `int [][] res = new int [n-2][n-2];`\n2.  loop the result array elements -> res i.e. loop till i and j till n-2, we are iterating this because we will store the Max element of each quadrant (will discuss later).\n3.  create a method getMaxVal, take input the values of i and j from the loop and also the original array.\n4.  we will use this method to the max value from the each quadrant, and has we know by the question the max quadrant value is 3 therefore we keep this mind while iteration i and j till only i+2 and j+2 also while iteration we will calculate the max of each quadrant.\n5.  after getting the max we will return. max value will be set in the res array.
['Java']