135. Max Points on a Line

HardMath

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.

Examples

Input: [[1,1],[3,2],[5,3],[4,1],[2,3],[1,4]]

Output: 4

Explanation: The best line contains 4 of the points.

Constraints

  • 1 <= points.length <= 300
  • points[i].length == 2
  • -10^4 <= xi, yi <= 10^4
  • All the points are unique.
Loading...

Run checks all cases above. Submit evaluates all test cases.