Tap here to switch tabs
Problem
Submissions

Problem: Max Points on a Line

Max Points on a Line gives an array of unique points on the X–Y plane. Return the greatest number of points that lie on one straight line, including vertical lines.

Statement

Given an integer array of points where points[i]=[xi,yi]\text{points}[i] = [x_i, y_i] represents a point on the X–Y plane, your task is to return the maximum number of points on the same straight line.

Constraints:

  • 1≤1 \leq points.length ≤300\leq 300

  • points[i].length =2= 2

  • −104≤xi,yi≤104-10^4 \leq x_i, y_i \leq 10^4

  • All the points are unique.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Max Points on a Line

Max Points on a Line gives an array of unique points on the X–Y plane. Return the greatest number of points that lie on one straight line, including vertical lines.

Statement

Given an integer array of points where points[i]=[xi,yi]\text{points}[i] = [x_i, y_i] represents a point on the X–Y plane, your task is to return the maximum number of points on the same straight line.

Constraints:

  • 1≤1 \leq points.length ≤300\leq 300

  • points[i].length =2= 2

  • −104≤xi,yi≤104-10^4 \leq x_i, y_i \leq 10^4

  • All the points are unique.