Maximum Area Rectangle With Point Constraints II - Problem
Imagine you're a city planner working with a grid-based map where certain locations are marked as special landmarks. Your task is to find the largest rectangular park that can be built using exactly four of these landmarks as corners.
Given n points on an infinite 2D plane with coordinates (xCoord[i], yCoord[i]), you need to find the maximum area rectangle that:
- Uses exactly four points as its corners
- Has edges parallel to the axes (axis-aligned)
- Contains no other points inside or on its borders
Return the maximum area possible, or -1 if no valid rectangle can be formed.
Example: With points [(1,1), (1,3), (3,1), (3,3), (2,2)], the rectangle with corners (1,1), (1,3), (3,1), (3,3) would be invalid because (2,2) lies inside it.
Input & Output
Constraints
💡
Explanation
AI Ready
💡 Suggestion
Tab
to accept
Esc
to dismiss
// Output will appear here after running code