IsLinear
Easy
Given an array of 2D points, returns whether they form a line.
Parameter(s):
Returns:
Constraints:
arr ≠ null
1 ≤ arr.length ≤ 1000
-2147483647 ≤ arr[i][0] ≤ 2147483647
-2147483647 ≤ arr[i][1] ≤ 2147483647
Example 1:
Input:
[[0,0],[1,1]]
Output:
true
Example 2:
Input:
[[0,0],[1,1],[1,2]]
Output:
false