Math Fundamentals18 sections · 814 units
Open in Course

Minimum Area Rectangle - Algorithm

Check all diagonal pairs

1.1. Store all points in a hash set.

2.2. For each pair of points (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) where x1x2x_1 \neq x_2 and y1y2y_1 \neq y_2 (potential diagonal corners):

3.3. Check if (x1,y2)(x_1, y_2) and (x2,y1)(x_2, y_1) are in the set.

4.4. If yes, compute area and update minimum.