Skip to main content
Back to problems
Leetcode
Medium
Arrays
Geometry
Math
Largest Triangle Area

Given a set of points in the plane, find the maximum possible area of any triangle formed by choosing three points.

Acceptance 0%
Problem Statement

Problem

You are given a list of points on a 2D plane. Each point is represented by its integer coordinates. Choose any three distinct points and form a triangle.

Return the largest possible area among all such triangles.

The area may be a non-integer value.

Notes

  • Three points that lie on the same line form a triangle with area $0$.
  • You should consider every valid triplet of points.
  • The answer can be computed using the shoelace formula or an equivalent cross-product based area calculation.

Input Format

  • An array of points, where each point is a pair [x, y].

Output Format

  • A single numeric value representing the maximum triangle area.

Constraints

  • The number of points is at least 3.
  • Coordinates are integers.
  • Use a floating-point result if needed.

Hints

  • A triangle's area from three coordinates can be found without computing side lengths.
  • Try evaluating all triples of points and keep the maximum area found.

Input Format

  • A list of 2D points points, where points[i] = [x_i, y_i].
  • Each point is distinct.

Output Format

  • Return the maximum area of any triangle formed by three points from the list.

Constraints

  • 3 <= points.length
  • Coordinates are integers.
  • The answer may be a decimal value.
Examples
Sample cases returned by the problem API.

Example 1

Input

points = [[0,0],[0,1],[1,0],[0,2],[2,0]]

Output

2

Explanation

The largest triangle is formed by points [0,0], [0,2], and [2,0], which has area 2.

Example 2

Input

points = [[1,0],[0,0],[0,1]]

Output

0.5

Explanation

These three points form a right triangle with legs of length 1, so the area is 1/2.

Premium problem context

Unlock deeper context for this problem

Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.

Guided hints
Editorial and discussion links
Concept map and variants
Sign in to unlock
Track your progress
Sign in to bookmark this problem, save notes, and manage its revision plan.