c++ solution || O(n)
\nclass Solution {\npublic:\n    int countGoodRectangles(vector<vector<int>>& rectangles) {\n        unordered_map<int,int> maxsquarelen;\n        int maxlen=IN
```\nclass Solution {\npublic:\n    int countGoodRectangles(vector<vector<int>>& rectangles) {\n        unordered_map<int,int> maxsquarelen;\n        int maxlen=INT_MIN;\n        for(auto rectangle : rectangles){\n            maxsquarelen[min(rectangle[0],rectangle[1])]++;\n            maxlen = max(maxlen,min(rectangle[0],rectangle[1]));//store the maxpossible length of square formed\n        }\n        return maxsquarelen[maxlen];\n        //return ;\n    }\n};\n```
['C']