Python two loops (max_pooling)
Intuition\n Describe your first thoughts on how to solve this problem. \nThis is more like max_pooling in deep learning.\n\n# Approach\n Describe your approach 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThis is more like `max_pooling` in deep learning.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1. output shape would be `mxm`, where `m=n-3+1`\n2. loop through the `grid` matrix, get max value for each `3x3` block.\n\n# Complexity\n- Time complexity: `O(n^2)`\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: `O(m^2)` where `m=n-2`\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python\nclass Solution:\n    def largestLocal(self, grid: List[List[int]]) -> List[List[int]]:\n        n, m = len(grid), len(grid) - 3 + 1\n        res = [[0] * m for _ in range(m)]\n        for r in range(n - 2):\n            for c in range(n - 2):\n                mat = [row[c:c+3] for row in grid[r:r+3]]\n                res[r][c] = max([max(row) for row in mat])\n        return res\n```\n\n**Please upvote if you found this post helpful.**
['Python3']