Very Simple Approach ✔ Easy To Understand✔
\n# Code\n\nclass Solution {\npublic:\n    int findMax(int x,int y,vector<vector<int>>&grid){\n         int max=INT_MIN;\n         for(int i=x;i<x+3;i++){\n    
\n# Code\n```\nclass Solution {\npublic:\n    int findMax(int x,int y,vector<vector<int>>&grid){\n         int max=INT_MIN;\n         for(int i=x;i<x+3;i++){\n             for(int j=y;j<y+3;j++){\n                 if(max<grid[i][j])\n                   max=grid[i][j];\n             }\n         }\n         return max;\n    }\n    vector<vector<int>> largestLocal(vector<vector<int>>& grid) {\n        int n=grid.size();\n        vector<vector<int>>ans(n-2,vector<int>(n-2));\n        for(int i=0;i<n-2;i++){\n            for(int j=0;j<n-2;j++){\n                ans[i][j]=findMax(i,j,grid);\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']