Hard

Quiz

#149 Max Points on a Line

APPROACH

You are given an array points where each points[i] = [xi, yi] is a point on the X-Y plane. Return the maximum number of points that all lie on the same straight line.

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
1 of 4
1:00

What is the optimal approach for this problem?