<p>Given an array of points on the <strong>X-Y</strong> plane <code>points</code> where <code>points[i] = [x<sub>i</sub>, y<sub>i</sub>]</code>, return <em>the area of the largest triangle that can be formed by any three different points</em>. Answers within <code>10<sup>-5</sup></code> of the actual answer will be accepted.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<img alt="" src="https://s3-lc-upload.s3.amazonaws.com/uploads/2018/04/04/1027.png" style="height: 369px; width: 450px;" />
<pre>
<strong>Input:</strong> points = [[0,0],[0,1],[1,0],[0,2],[2,0]]
<strong>Output:</strong> 2.00000
<strong>Explanation:</strong> The five points are shown in the above figure. The red triangle is the largest.
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> points = [[1,0],[0,0],[0,1]]
<strong>Output:</strong> 0.50000
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>3 &lt;= points.length &lt;= 50</code></li>
	<li><code>-50 &lt;= x<sub>i</sub>, y<sub>i</sub> &lt;= 50</code></li>
	<li>All the given points are <strong>unique</strong>.</li>
</ul>

'''
- formula for finding area when points are given
    1/2 * ( ∣x1×(y2−y3)+x2×(y3−y1)+x3×(y1−y2)∣ )
- okay let's try for all combinations of three points
- for three points we need three pointers so three for loops
'''
class Solution:
    def largestTriangleArea(self, points: List[List[int]]) -> float:
        # Initialize the variable to store the maximum area found
        max_area = 0
        
        # Get the number of points
        n = len(points)
        
        # Iterate over all combinations of three different points
        for p1 in range(n-2):  # First point (start from 0 up to n-3)
            for p2 in range(p1+1, n-1):  # Second point (start from p1+1 to n-2)
                for p3 in range(p2+1, n):  # Third point (start from p2+1 to n-1)
                    # Extract coordinates of the three points
                    x1, y1 = points[p1]
                    x2, y2 = points[p2]
                    x3, y3 = points[p3]
                    
                    # Calculate the area of the triangle using the determinant formula
                    area = 1/2 * abs(
                        x1 * (y2 - y3) + 
                        x2 * (y3 - y1) + 
                        x3 * (y1 - y2)
                    )
                    
                    # Update max_area if the calculated area is larger
                    max_area = max(max_area, area)
        
        # Return the largest area found (float value)
        return max_area
16500