Count the magical rectangles formed by a set of unique 2D points.
Unlock detailed company stats for this questionUpgrade
You are given a set of N unique 2D point coordinates (x, y) on the Cartesian plane. Find the number of magical rectangles that can be formed with the given points. A magical rectangle is an empty rectangular non-zero area parallel to the coordinate axes, delimited only by an upper left point and a lower right point, with no other points on the perimeter or within its area.
Examples:
- [(10,0), (0,10)] -> 1
- [(0,0), (1,1), (2,2)] -> 0
- [(2,0), (1,1), (0,2)] -> 2 (AB, BC)
- [(0,0), (1,0)] -> 0
Community answers
No answers contributed by the community yet.
Related questions
Find the maximum-size rectangle that can be formed from a given set of points.Given points on a 2D plane, find the maximum area of a rectangle that can be formed using them.Count the squares formed by connected points in a grid diagram.Related courses

Course

Course
Course
