Leetcode 1843 Solution

This article provides solution to leetcode question 1843 (number-of-rectangles-that-can-form-the-largest-square)

https://leetcode.com/problems/number-of-rectangles-that-can-form-the-largest-square

Solution

class Solution:
    def countGoodRectangles(self, rectangles: List[List[int]]) -> int:
        d = [min(l, w) for l, w in rectangles]
        return sum([x == max(d) for x in d])