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.

&nbsp;
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


&nbsp;
Constraints:


	3 &lt;= points.length &lt;= 50
	-50 &lt;= xi, yi &lt;= 50
	All the given points are unique.


from itertools import combinations
class Solution:
    def largestTriangleArea(self, points: List[List[int]]) -> float:
        maxA = 0
        for p1, p2, p3 in combinations(points, 3):
            x1, y1 = p1
            x2, y2 = p2
            x3, y3 = p3
            A=(1/2) * abs(x1*(y2 - y3) + x2*(y3 - y1)+ x3*(y1 - y2))
            if A > maxA: maxA = A
        return maxA
class Solution {
    public double largestTriangleArea(int[][] points) {
        double ans = 0;
        int n = points.length;
        for(int i=0;i<n;i++){
            for(int j=i+1;j<n;j++){
                for(int k=j+1;k<n;k++){
                    ans = Math.max(ans,0.5*Math.abs(points[i][0]*(points[j][1] - points[k][1]) + points[j][0]*( points[k][1] - points[i][1]) + points[k][0]*(points[i][1] - points[j][1])));
                }
            }
        }
        return ans;
    }
}
class Solution {
public:
    double largestTriangleArea(vector<vector<int>>& points) {
        double ans = 0.00000;
        for(int i = 0; i<points.size(); ++i)
            for(int j = 0; j<points.size(); ++j)
                if(i!=j)
                    for(int k = 0; k<points.size(); ++k)
                        if(k!=i and k!=j)
                        {
                            //For triangle formed by 3 points a,b and c: the area will be = 1/2 * [(xa*yb + xb*yc + xc*ya) - (ya*xb + yb*xc + yc*xa)]
                            ans = max(ans, 0.50000 * (points[i][0]*points[j][1] + points[j][0]*points[k][1] + points[k][0]*points[i][1] - points[i][1]*points[j][0] - points[j][1]*points[k][0] - points[k][1]*points[i][0]));
                        }
        return ans;
    }
};
var largestTriangleArea = function(points) {
    const n = points.length;
    let maxArea = 0;
    
    for (let i = 0; i < n; i++) {
        for (let j = i + 1; j < n; j++) {
            for (k = j + 1; k < n; k++) {
                const area = calcArea(points[i], points[j], points[k]);
                maxArea = Math.max(maxArea, area);
            }
        }
    }

    return maxArea;
};


function calcArea(coordA, coordB, coordC){
    const [xCoordA, yCoordA] = coordA;
    const [xCoordB, yCoordB] = coordB;
    const [xCoordC, yCoordC] = coordC;
    
    const sideA = xCoordA * (yCoordB - yCoordC);
    const sideB = xCoordB * (yCoordC - yCoordA);
    const sideC = xCoordC * (yCoordA - yCoordB);
    
    return Math.abs((sideA + sideB + sideC) / 2);
}
Largest Triangle Area