Zepruv › Coding problems

Largest Triangle Area

Easy · Array, Math, Geometry

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

Input: points = [[0,0],[0,1],[1,0],[0,2],[2,0]]
Output: 2.00000

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

Constraints

Starter code (python)

class Solution(object):
    def largestTriangleArea(self, points):
        """
        :type points: List[List[int]]
        :rtype: float
        """
        

Related problems

Previous: Subdomain Visit Count · Next: Largest Sum of Averages · All problems

Zepruv is a technical interview practice platform. Read any problem for free; sign in to run your code, submit and keep your progress.