Talentd
FleetCode

1037. Valid Boomerang

Easy40.5% acceptance2 companies

Given an array points where points[i] = [xi, yi] represents a point on the X-Y plane, return true if these points are a boomerang.

A boomerang is a set of three points that are all distinct and not in a straight line.

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

Asked at 2 companies

Hints open one at a time

Hint 1
3 points form a boomerang if and only if the triangle formed from them has non-zero area.
9:30
Still stuck?Read 3 approaches, or watch a walkthrough.
Open solution
Loading editor…
1class Solution:
2 def isBoomerang(self, points: List[List[int]]) -> bool:
3
Starter codePython 3Spaces: 4
Examples
Input
[[1,1],[2,3],[3,2]]
Input
[[1,1],[2,2],[3,3]]
Your code is saved on this device.Solution