Simple solution with HashMap in Python3
Intuition\nHere we have:\n- list of rectangles with height and width\n- our goal is to find maximized count of rects we can cut, to have a perfect square \n\nAt
# Intuition\nHere we have:\n- list of `rectangles` with height and width\n- our goal is to find **maximized count** of rects **we can cut**, to have a **perfect square** \n\nAt each step we should somehow **cut** all of the rects to find a `maxLen`.\n\nFor this problem we\'re going to use **HashMap** to track **frequency** of **max possible length of size of a square**.\n\nDefinitely, we **can\'t** choose a maximum size of a **rect**, since we only **cut** (and not **extend**) sides.\n\nThus, at each step **we should consider the least length** of a particular rectangle.\n\n# Approach\n1. define `rects` to be a **HashMap**\n2. iterate over `rectangles` and find minimum sides for each rect, then increase a frequency\n3. define `ans` and `maxFreq` to iterate over all enumerated `rects` and update `ans`, if `maxFreq` at a particular step is **more**, than previous one.\n4. return `ans`\n\n# Complexity\n- Time complexity: **O(N + K)**, for twice-iterating over `rectangles` and `rects`\n\n- Space complexity: **O(K)**, since we store `rects`\n\n# Code\n```\nclass Solution:\n    def countGoodRectangles(self, rectangles: List[List[int]]) -> int:\n        rects = defaultdict(int)\n\n        for a, b in rectangles:\n            rects[min(a, b)] += 1\n\n        ans = 0\n        maxFreq = 0\n\n        for k, v in rects.items():\n            if k > maxFreq:\n                maxFreq = k\n                ans = v\n\n        return ans\n```
['Array', 'Hash Table', 'Python3']