Given an array of points where points[i] = [xi, yi] represents a point on the X-Y plane, return the maximum number of points that lie on the same straight line.
Example 1
Input: points = [[1,1],[3,2],[5,3],[4,1],[2,3],[1,4]]
Output: 4
Explanation: (1,4), (2,3), (3,2) and (4,1) all satisfy x + y = 5, so they lie on one line. No line passes through 5 of the points.
Example 2
Input: points = [[1,1],[2,2],[3,3]]
Output: 3
Explanation: All three points lie on the line y = x.
Example 3
Input: points = [[0,0]]
Output: 1
Explanation: A single point is on a line by itself, so the answer is 1.
Fix each point as an anchor and count how many other points share the same slope relative to it. Points on one line through the anchor all have equal slope, so the largest slope bucket (plus the anchor itself) gives the best line through that anchor.
Run checks all cases above. Submit evaluates all test cases.