Largest Triangle Area

Given an array of points on the X-Y plane points where points[i] = [xi, yi], return the area of the largest triangle that can be formed by any three different points.

Answers within 10^-5 of the actual answer will be accepted.

Example 1
Inputpoints = [[0,0],[0,1],[1,0],[0,2],[2,0]]
Output2
The five points are shown in the above figure, and the red triangle is the largest.
Example 2
Inputpoints = [[1,0],[0,0],[0,1]]
Output0.5
The three given points form a right triangle with area 0.5.

Constraints

  • 3 <= points.length <= 50
  • -50 <= xi, yi <= 50
  • All the given points are unique.

Asked at 3 companies

</>

Your Solution

(Ctrl/Cmd + Enter)

Switching Language

Loading template...

Loading...

Sign in to save your progress

AI code evaluation

Get a correctness verdict, missed edge cases, and complexity analysis of your solution.

Sign in to evaluate