LeetCode 149 Max Points on Line - Problem Statement

The problem

You're given an array of points on a 2D plane where points[i] = [xi, yi]. Return the maximum number of points that lie on the same straight line.

With points = [[1,1], [2,2], [3,3]], the answer is 3. All three points lie on the line y=xy = x.

Any two points define a line. The question is: how do you efficiently find which line passes through the most points?

Constraints: 1n3001 \le n \le 300. All points have unique coordinates.