#3047

Find the Largest Area of Square Inside Two Rectangles

specialist · 625 · lc medium +29 · 66.9% accepted · 438 likes · top 73%

Description

You have n axis-aligned rectangles in a 2D plane. Their corners are given by bottomLeft[i] = [a_i, b_i] and topRight[i] = [c_i, d_i]. Find the largest square that fits entirely within the overlapping region of at least two rectangles. Return 0 if no such square exists.

Code

1
2
3