✅C++ solution with sorting!
If you\u2019re interested in coding you can join my Discord Server, link in the comment section. Also if you find any mistakes please let me know. Thank you!\u2
> **If you\u2019re interested in coding you can join my Discord Server, link in the comment section. Also if you find any mistakes please let me know. Thank you!\u2764\uFE0F**\n> \n\n---\n## Code:\n\n```\nclass Solution {\npublic:\n    int countGoodRectangles(vector<vector<int>>& rectangles) {\n        int count=0;\n        vector<int>a;\n        for(int i=0; i<rectangles.size();i++)\n        {\n            int m=rectangles[i][0], n=rectangles[i][1];\n            int y=min(m,n);\n            a.push_back(y);\n        }\n        sort(a.begin(),a.end());\n        int n=a.size();\n        int x=a[n-1];\n        for(int i=0;i<n;i++)\n        {\n            if(a[i]==x)\n                count++;\n        }\n        return count;\n    }\n};\n```\n---\n***Please upvote if it was helpful for you, thank you!***
['C', 'C++']