1725. Number Of Rectangles That Can Form The Largest Square

Обновлено: 2024-03-12
1 мин
[]

Содержание

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