Given
n
point on a 2D-plane as pair of (x, y) coordinates in the form of a 2-D integer array
arr
of size
nx2
, Write a program to find the
maximum number of points which lie on the same line.
Example 1
Input: arr[][] = [[1, 1], [2, 2], [1, 2], [3, 3], [2, 3]]
Output: 3
Explanation: The maximum number of points that lie on the same line are 3, those points are [1, 1], [2, 2] and [3, 3].
Example 2
Input: arr[][] = [[1, 1], [3, 2], [5, 3], [4, 1], [2, 3], [1, 4]]
Output: 4
Explanation: The maximum number of points that lie on the same line are 4, those points are [3, 2], [4, 1], [2, 3] and [1, 4].