Back to course home
0% completed
Vote For New Content
Max Points on a Line (hard)
Problem Statement
Given an array containing points
where points[i] = [xi, yi]
represents a point on the X-Y plane
, return the maximum
number of points that are on the same straight line
.
Examples
-
Example 1:
- Input: points =
[[1,2], [3,6], [5,10], [7,14]]
- Expected Output:
4
- Justification: All points lie on the line (y = 2x), forming a straight line with all given points.
- Input: points =
-
Example 2:
- Input: points =
[[1,1], [2,2], [3,3], [8,10]]
- Expected Output:
3
- Input: points =
.....
.....
.....
Like the course? Get enrolled and start learning!
On this page