Back to course home
0% completed
Solution: Max Points on a Line
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!
Table of Contents
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible