1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts
On This Page
class Solution:
def maxArea(
self, h: int, w: int, horizontalCuts: List[int], verticalCuts: List[int]
) -> int:
horizontalCuts.extend([0, h])
verticalCuts.extend([0, w])
horizontalCuts.sort()
verticalCuts.sort()
x = max(b - a for a, b in pairwise(horizontalCuts))
y = max(b - a for a, b in pairwise(verticalCuts))
return (x * y) % (10**9 + 7)