From LeetCode. Shoelace formula - max area from points. Solve the geometry problem "Largest Triangle Area".
Examples
Input:[1,2,3]
Output:0
Input:[2,3,4]
Output:0
Hints
Use brute force over every triple of points — with up to 50 points, O(n³) is perfectly fine. The area of a triangle from three coordinate points can be computed with the shoelace formula: `0.5 * |x1*(y2 - y3) + x2*(y3 - y1) + x3*(y1 - y2)|`.
Take the absolute value of the shoelace determinant and multiply by 0.5. Track the maximum area seen across all triples.
If the shoelace formula gives 0, the three points are collinear — skip that triple since it forms a degenerate triangle with zero area.
Largest Triangle Area
**From LeetCode.** Shoelace formula - max area from points. Solve the geometry problem "Largest Triangle Area".