1
var isBoomerang = function (points) {
2
// if any two of the three points are the same point return false;
3

4
if (points[0][0] == points[1][0] && points[0][1] == points[1][1])
5
return false;
6
if (points[0][0] == points[2][0] && points[0][1] == points[2][1])
7
return false;
8
if (points[2][0] == points[1][0] && points[2][1] == points[1][1])
9
return false;
10

11
// if the points are in a straight line return false;
12

13
let slope1 = (points[0][1] - points[1][1]) / (points[0][0] - points[1][0]);
14
let slope2 = (points[1][1] - points[2][1]) / (points[1][0] - points[2][0]);
15
if (points[0][0] == points[1][0] && points[0][0] === points[2][0])
16
return false;
17
if (points[0][1] == points[1][1] && points[0][1] === points[2][1])
18
return false;
19

20
if (slope1 === slope2) return false;
21

22
return true;
23
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0