In this article, we have discussed how to find the number of rectangles (parallel to the axes) possible from a given set of coordinate points.
Table of content:
ExampleBrute Force ApproachEfficent ApproachAlgorithmImplementationComplexity AnalysisExample
Let us suppose we have the set of coordinates as [{1,1}, {7,1}, {1,4}, {1,5}, {7,4}, {7,5}]
8 | 7 | 6 | (1,5) (7,5)5 | * *4 | * *3 | (1,4) (7,4)2 | (1,1) (7,1)...