[Python] O(n) time and O(1) space
\ndef countGoodRectangles(self, rectangles):\n        """\n        :type rectangles: List[List[int]]\n        :rtype: int\n        """\n        max_len = 0\n   
```\ndef countGoodRectangles(self, rectangles):\n        """\n        :type rectangles: List[List[int]]\n        :rtype: int\n        """\n        max_len = 0\n        count_max = 0\n        for l, w in rectangles:\n            min_len = min(l, w)\n            if min_len > max_len:\n                max_len = min_len \n                count_max = 0\n            if min_len == max_len:\n                count_max += 1\n        return count_max\n```
[]