Bloomberg Interview Question

Write a function that finds all the rectangles given series of points.