Rakuten Interview Question

The online coding test was about find the intersection of two rectangles.