Class Solution

java.lang.Object
g0801_0900.s0812_largest_triangle_area.Solution

public class Solution extends Object
812 - Largest Triangle Area.<p>Easy</p> <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><strong>Example 1:</strong></p> <p><img src="https://s3-lc-upload.s3.amazonaws.com/uploads/2018/04/04/1027.png" alt="" /></p> <p><strong>Input:</strong> points = [[0,0],[0,1],[1,0],[0,2],[2,0]]</p> <p><strong>Output:</strong> 2.00000</p> <p><strong>Explanation:</strong> The five points are shown in the above figure. The red triangle is the largest.</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> points = [[1,0],[0,0],[0,1]]</p> <p><strong>Output:</strong> 0.50000</p> <p><strong>Constraints:</strong></p> <ul> <li><code>3 <= points.length <= 50</code></li> <li><code>-50 <= x<sub>i</sub>, y<sub>i</sub> <= 50</code></li> <li>All the given points are <strong>unique</strong>.</li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • largestTriangleArea

      public double largestTriangleArea(int[][] points)