Search⌘ K
AI Features

Solution: Maximum Area Rectangle With Point Constraints I

Explore how to identify the largest rectangle area from given points on a 2D plane, ensuring its borders align with axes and contain no additional points. Understand the algorithm that uses set lookups and geometric validation to confirm rectangle formation while maximizing area.

Statement

You are given an array of points, where points[i] have two values: [xi,yi][x_i, y_i], representing its position on a flat plane.

Your goal is to find the largest rectangle (having maximum area) that can be formed using any four points as the corners. The rectangle should meet the following conditions:

  • It has its borders parallel to the axes.

  • It should not contain any other points inside or along its border.

Return the area of the largest rectangle you can create. If no such rectangle can be formed, return 1-1.

Constraints:

  • 11 \leq points.length ...