#3588
Find Maximum Area of a Triangle
expert · 1135 · lc medium +32 · 29.1% accepted · 52 likes · top 6%
Description
A 2D array coords of size n x 2 gives coordinates of n points on a Cartesian plane.
Among all triangles whose three vertices come from coords and which have at least one side parallel to the x-axis or y-axis, find the one with maximum area A and return 2 * A.
Return -1 if no such non-degenerate triangle exists.
Code
1
2
3