A boomerang is a set of 3 points that are all distinct and not in a straight line.
Given a list of three points in the plane, return whether these points are a boomerang.
Example 1:
Input: [[1,1],[2,3],[3,2]] Output: trueExample 2:
Input: [[1,1],[2,2],[3,3]] Output: false
Note:
points.length == 3
points[i].length == 2
0 <= points[i][j] <= 100
boolean b1 = Arrays.equals(points[0], points[1]);
boolean b2 = Arrays.equals(points[0], points[2]);
boolean b3 = Arrays.equals(points[1], points[2]);
boolean isEqual = b1 || b2 || b3;
int[] xArr = new int[]{points[0][0], points[1][0], points[2][0]};
int[] yArr = new int[]{points[0][1], points[1][1], points[2][1]};
boolean isLine = (yArr[1]-yArr[0])*(xArr[2]-xArr[0]) == (yArr[2]-yArr[0])*(xArr[1]-xArr[0]);
return !(isEqual || isLine);