MediumRating 1743
3380. Maximum Area Rectangle With Point Constraints I
arraymathbinary-indexed-treesegment-treegeometrysortingenumeration
解題說明
C++ 解法
複雜度分析
虛擬碼
1. Store all points in a set for O(1) lookup 2. For each pair of points (p1, p2) as diagonal: a. Skip if same x or same y b. Check if (p1.x, p2.y) and (p2.x, p1.y) exist in set c. If all 4 corners exist, check no other points inside or on edges d. If valid, compute area and update max 3. Return max area or -1