points[i] = [x, y] are different points on a plane. Return the largest number of points that lie on the same straight line.
For [[1, 1], [2, 2], [3, 3]] the answer is 3; for [[1, 1], [3, 2], [5, 3], [4, 1], [2, 3], [1, 4]] it is 4.
The starter code tests every triple of points. It is correct but too slow for many points.
Example 1
Input:
max_points([[1, 1], [2, 2], [3, 3]])
Output:
3
Example 2
Input:
max_points([[1, 1], [3, 2], [5, 3], [4, 1], [2, 3], [1, 4]])
Output:
4
0 <= len(points) <= 3000 <= x, y <= 10000No results yet
Run your code to check it against the examples, or submit to run every test.