Search⌘ K
AI Features

Solution: Maximum Area Rectangle With Point Constraints I

Explore techniques to identify the largest rectangle formed by points on a 2D plane with edges parallel to axes. Understand how to validate rectangle corners, check for point constraints inside or on edges, and calculate maximum area efficiently using set lookups and coordinate comparisons.

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 ...