Overlapping rectangles hackerrank solution

/body>