Amazon Interview Question

Check if the rectangles are overlapping