From LeetCode. Area from coordinates. Solve the geometry problem "Find Maximum Area of a Triangle".
Examples
Input:[1,2,3]
Output:0
Input:[2,3,4]
Output:0
Hints
The area of any triangle formed by points on a 2D plane can be computed using the shoelace formula: `0.5 * |(x1*(y2 - y3) + x2*(y3 - y1) + x3*(y1 - y2))|`. This works in integer coordinates without needing floating-point until the final division.
Use O(n³) brute force over all triples of points, or use the convex hull to reduce candidate points — the maximum area triangle's vertices always lie on the convex hull of the point set.
Collinear triples produce zero area — skip them. If fewer than 3 non-collinear points exist, return 0.
Find Maximum Area of a Triangle
**From LeetCode.** Area from coordinates. Solve the geometry problem "Find Maximum Area of a Triangle".