TomoLink
CompaniesMetaData Structures & AlgorithmsMax Points on a Line
DSA
HardArray

Max Points on a Line

arrayhash tablemath

Problem Statement

Given an array of points where points[i] = [x _i , y _i ] represents a point on the X-Y plane, return the maximum number of points that lie on the same straight line .

Examples

Example 1
Input: points = [[1,1],[2,2],[3,3]]
Output: 3
Example 2
Input: points = [[1,1],[3,2],[5,3],[4,1],[2,3],[1,4]]
Output: 4

Constraints

1 <= points.length <= 300
points[i].length == 2
-10 ^4 <= x _i , y _i <= 10 ^4
All the points are unique .
😤
Hard
Difficulty
Topic Info
ModuleDSA
CategoryArray
Sub-topicHash Table
Tags
arrayhash tablemathgeometry
Navigation
Max Points on a Line [Hard] | Meta Dsa | TomoLink