[Java/Python 3] 1 pass O(n) time O(1) space.
There are 3 cases after initializing the counter cnt and the max side mx as 0:\nThe square side\n1)  greater than mx, reset cnt to 1 and update mx;\n2) == mx, i
There are 3 cases after initializing the counter `cnt` and the max side `mx` as `0`:\nThe square side\n1)  greater than `mx`, reset `cnt` to `1` and update `mx`;\n2) == `mx`, increase `cnt` by 1;\n3) less than `mx`, ignore it.\n\n\n```java\n    public int countGoodRectangles(int[][] rectangles) {\n        int cnt = 0, mx = 0;\n        for (int[] rec : rectangles) {\n            int side = Math.min(rec[0], rec[1]);\n            if (side > mx) {\n                cnt = 1;\n                mx = side;\n            }else if (side == mx) {\n                ++cnt;\n            }\n        }\n        return cnt;\n    }\n```\n```python\n    def countGoodRectangles(self, rectangles: List[List[int]]) -> int:\n        cnt = mx = 0\n        for l, w in rectangles:\n            side = min(l, w)\n            if side > mx:\n                cnt, mx = 1, side\n            elif side == mx:\n                cnt += 1\n        return cnt\n```
[]