Search⌘ K
AI Features

Solution: Max Points on a Line

Solution: Max Points on a Line asks you to find the largest group of unique points from an X–Y plane that all lie on one straight line, including vertical or horizontal 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 ...