Valid Boomerang Lab
Easy
4
25.8% Acceptance
In this lab, you will implement a function to determine if a set of points in the X-Y plane represents a valid boomerang. A valid boomerang is a set of three points that are all distinct and not in a straight line.
You will be provided with an array points
where points[i] = [xi, yi]
representing a point on the X-Y plane. Your task is to return true
if these points are a valid boomerang, and false
if they are not.
Here are some examples to help you understand the problem better:
Example 1:
Input: points = [[1,1],[2,3],[3,2]]
Output: true
Example 2:
Input: points = [[1,1],[2,2],[3,3]]
Output: false
Constraints:
points.length == 3
points[i].length == 2
0 <= xi, yi <= 100
To complete this lab, you have to:
- Implement the
isBoomerang
function inindex.js
- Export the
isBoomerang
function as the default export ofindex.js
- Make sure the function passes all the challenges below.
Challenges
- Export
isBoomerang
as the default export ofindex.js
. - Determine if the given set of points represents a valid boomerang.