Codility test on Rectangle Intersection