A ride-hailing team wants to plan a straight shuttle road through the city. Each pending pickup sits at an integer point [x, y] on the city map, and no two pickups share a point.
Given the list pickups, return the largest number of pickups that lie on one straight line. The line may point in any direction, including straight up and down.
Input: pickups = [[0,-1],[1,1],[2,3],[3,5],[4,2]]
Output: 4
[0,-1], [1,1], [2,3] and [3,5] each rise by 2 for every step of 1 to the right, so they share one line. [4,2] is off it.
Input: pickups = [[3,0],[1,4],[5,-4],[3,5],[-1,8],[3,-2]]
Output: 4
[-1,8], [1,4], [3,0] and [5,-4] fall by 4 for every step of 2 to the right. Seen from [3,0], [1,4] lies up-left and [5,-4] down-right, yet both are on the same line. The vertical line x = 3 holds only three pickups.
Input: pickups = [[7,-3]]
Output: 1
A single pickup is a line of one.
1 <= pickups.length <= 300pickups[i].length == 2-10^4 <= pickups[i][0], pickups[i][1] <= 10^4