Easiest C++ Solution || Beginner Friendly ||  Hashmap || Without using sorting || O(N)
Intuition\n Describe your first thoughts on how to solve this problem. \nTo maximize the side length of a square that can fit in each rectangle, use the smaller
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nTo maximize the side length of a square that can fit in each rectangle, use the smaller dimension of the rectangle. Count how many rectangles can form squares with the largest possible side length.\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1) Iterate through the list of rectangles and calculate the maximum square side length possible for each rectangle.\n2) Use a hashmap (unordered_map) to store the count of occurrences for each square side length.\n3) Traverse the hashmap to find the largest square side length and return its count.\n4) This approach ensures efficient computation with a time complexity of O(n), where n is the number of rectangles.\n# Complexity\n- Time complexity:O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(N)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int countGoodRectangles(vector<vector<int>>& rectangles) {\n        // Get the number of rectangles\n        int n = rectangles.size();\n        \n        // Variable to track the maximum side length of the square\n        int maxLen = INT_MIN;\n        \n        // Hashmap to count occurrences of each square side length\n        unordered_map<int, int> mpp;\n        \n        // Iterate through each rectangle\n        for (int i = 0; i < n; i++) {\n            // Calculate the maximum square side length for this rectangle\n            int side = min(rectangles[i][0], rectangles[i][1]);\n            \n            // Increment the count for this side length in the map\n            mpp[side]++;\n        }\n        \n        // Variable to store the count of rectangles forming the largest squares\n        int num;\n        \n        // Traverse the hashmap to find the maximum side length and its count\n        for (auto it : mpp) {\n            if (it.first > maxLen) {\n                maxLen = it.first;  // Update the maximum side length\n                num = it.second;    // Update the count of rectangles\n            }\n        }\n        \n        // Return the count of rectangles forming the largest squares\n        return num;\n    }\n};\n\n```
['C++']