1725. Number Of Rectangles That Can Form The Largest Square

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 1725

class Solution:
    def countGoodRectangles(self, rectangles: List[List[int]]) -> int:
        res = mx = 0
        for l, w in rectangles:
            x = min(l, w)
            if mx < x:
                res = 1
                mx = x
            elif mx == x:
                res += 1
        return res