You are given an array of βPOINTSβ in a 2-D cartesian plane, where βPOINTS[i] = [Xi, Yi]β, in which βXiβ denotes the x-coordinate of the βiβth point, and βYiβ denotes the y-coordinate of the βiβth point.
Letβs define the term βBoomerangβ as the set of three distinct points that are not in a straight line. Your task is to find out whether these points are a βboomerangβ or not.
Note :1. The size of the array βPOINTSβ is always β3β.
2. For better understanding, you may look at the sample test cases.
The first line contains an integer βTβ, which denotes the number of test cases to be run. Then, the T test cases follow.
The next β3β line of each test case contains two positive integers, βXiβ, and βYiβ, denoting the x and y coordinates of the ith point.
Output Format :
For each test case, print βtrueβ if the given points are a βboomerangβ. Otherwise, print βfalseβ.
Output for each test case will be printed in a separate line.
Note :
You do not need to print anything. It has already been taken care of. Just implement the given function.
1 <= βTβ <= 10^5
POINTS.length == 3
POINTS[i].length == 2
-100 <= βXiβ, βYiβ <= 100
Where βPOINTSβ is an array of points, βXiβ and βYiβ are the i-th pointβs x and y coordinates.
Time Limit: 1sec
2
0 0
1 1
2 2
0 0
1 1
2 1
false
true
Test Case 1 :
If you look at the graph, all three points are in a straight line.

Test Case 2 :
If you look at the graph, there is no straight line possible to pass through all three points.

2
4 0
4 5
2 1
2 2
2 4
2 6
true
false
Think of finding the area of a triangle.
O(1).
As we are using only a variable to store the area of the triangle. Hence, the time complexity will be O(1).
O(1).
As we are using constant extra space.