Find Minimum Area of Rectangle Formed from Given Shuffled Coordinates
Assuming an array arr of size N, the array represents N / 2 coordinates of a rectangle with its X and Y coordinates randomly shuffled. The goal of this issue is to create N / 2 pairs of (X, Y) coordinates by selecting X and Y from the array arr in such a way that a rectangle containing all of these points has the smallest area.
Assume we get an array of points in the XY plane. We must determine the smallest rectangle that may be created from these spots. The rectangle's sides must be parallel to the X and Y axes. If we are unable to form the rectangle, we will return 0. So, if the point array is [(1, 1), (1, 3), (3, 1), (3, 3), (2, 2)]. The result will be 4. Because the rectangle may be created by connecting the points (1, 1), (1, 3), (3, 1), and (3, 1), (3, 3).
To address the problem, follow the instructions below:
The aforesaid technique is implemented as follows: