pins, where pins[i] = [x, y]. You want to stretch a rubber band around four of the pins so that it forms a rectangle. The sides **don't have to** be parallel to the axes: the rectangle can be rotated any way.
Return the smallest area of such a rectangle. If no four pins form a rectangle, return 0.
Answers within 10⁻⁵ of the exact value are accepted.pins=[[0, 2], [2, 0], [3, 1], [1, 3]] → 4.000000000000001
These four points form a tilted rectangle with sides √8 and √2, so its area is 4.
pins=[[0, 0], [0, 1], [1, 0], [1, 1], [2, 1], [1, 2]] → 1.0
There is a square [0, 0], [0, 1], [1, 1], [1, 0] of area 1 and a tilted square [1, 0], [2, 1], [1, 2], [0, 1] of area 2. The smaller one wins: 1.
pins=[[0, 0], [1, 2], [3, 3]] → 0
Three points cannot make a rectangle, so the answer is 0.
pins=[[0, 2], [2, 0], [3, 1], [1, 3]]
4.000000000000001
Run checks the first 3 tests in your browser. Submit checks all 101 tests on the server, hidden ones included.