Given two array of integers **A** and **B** describing a pair of **(A[i], B[i])** coordinates in 2-D plane.

**A[i]** describe x coordinates of the i^{th} point in 2D plane whereas **B[i]** describes the y-coordinate of

the i^{th} point in 2D plane.

Find and return the maximum number of points which lie on the same line.

**Input Format**

```
The arguments given are integer arrays A and B.
```

**Output Format**

```
Return the maximum number of points which lie on the same line.
```

**Constraints**

```
1 <= (length of the array A = length of array B) <= 1000
-10^5 <= A[i], B[i] <= 10^5
```

**For Example**

```
Input 1:
A = [-1, 0, 1, 2, 3, 3]
B = [1, 0, 1, 2, 3, 4]
Output 1:
4
The maximum number of point which lie on same line are 4, those points are {0, 0}, {1, 1}, {2, 2}, {3, 3}
Input 2:
A = [3, 1, 4, 5, 7, -9, -8, 6]
B = [4, -8, -3, -2, -1, 5, 7, -4]
Output 2:
2
```

NOTE:You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.

Sign Up

to access hints and editorial solutions for**Maximum Points on the same line**

to access hints and editorial solutions for

Loading...