1. Description
Given an array of points on the X-Y plane points where points[i] = [x$_i$, y$_i$], 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.
2. Example
Example 1

Input: points = [[0,0],[0,1],[1,0],[0,2],[2,0]]
Output: 2.00000
Explanation: The five points are shown in the above figure. The red triangle is the largest.
Example 2
Input: points = [[1,0],[0,0],[0,1]]
Output: 0.50000
3. Constraints
- 3 <= points.length <= 50
- -50 <= x$_i$, y$_i$ <= 50
- All the given points are unique.
4. Solutions
Brute Force
n = points.size()
Time complexity: O(n$^3$)
Space complexity: O(1)
| |