#3382
Maximum Area Rectangle With Point Constraints II
international master · 2135 · lc hard +32 · 23.8% accepted · 48 likes · top 3%
Description
There are n points on an infinite plane. You are given two integer arrays xCoord and yCoord where (xCoord[i], yCoord[i]) is the ith point.
Find the maximum area of an axis-aligned rectangle that:
- Uses exactly four of the given points as corners.
- Contains no other given point inside or on its border.
Return the maximum area, or -1 if no such rectangle exists.
Code
1
2
3