Easiest C++ Solution without Sorting ✅
Intuition\nThe code first calculates the largest square that can be cut from each rectangle by taking the minimum of the rectangle\'s length and width. It then 
# Intuition\nThe code first calculates the largest square that can be cut from each rectangle by taking the minimum of the rectangle\'s length and width. It then uses an unordered map to count how many times each square size appears. The code then iterates through the map to find the maximum square size (a) and stores the count (b) of how many rectangles can form this maximum square. Finally, it returns this count (b), which represents the number of rectangles that can form the largest square.\n\n# Approach\n1. Create a Map for Square Sizes: Iterate over each rectangle and determine the side length of the largest square it can form by taking the minimum of the two dimensions. Store these lengths in a map where the key is the side length and the value is the count of rectangles that can produce this square.\n2. Identify the Maximum Square Size: After populating the map, identify the largest square side length by iterating through the keys of the map.\n3. Count Rectangles for Max Square: Once the maximum square side length is determined, return the count of rectangles that can form this square, which is stored in the map.\n\n\n# Code Walkthrough \n1. The first loop populates the map m, where each key is the side length of the largest square that can be formed from a rectangle, and the value is the number of rectangles that can form that square.\n2. The second loop checks each key in the map to find the maximum square size (a) and retrieves the count (b) associated with that size.\n3. Finally, b is returned as it represents the number of rectangles that can form the largest square.\n\n# Time complexity : O(n)\n\n# Space complexity : O(n)\n\n# Code\n```\nclass Solution {\npublic:\n    int countGoodRectangles(vector<vector<int>>& v){\n        unordered_map<int,int> m;\n\n        for(int i=0;i<v.size();i++){\n            m[min(v[i][0],v[i][1])]++;\n        }\n\n        int a=INT_MIN,b=-1;\n        for(auto x : m){\n            if(x.first>a){\n                a=x.first;\n                b=x.second;\n            }\n        }\n        \n        return b;\n    }\n};\n```
['Array', 'Hash Table', 'C++']