1037. Valid Boomerang

Source code notebook Author Update time

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: true

Example 2:

Input: [[1,1],[2,2],[3,3]]
Output: false

Note:

  1. points.length == 3
  2. points[i].length == 2
  3. 0 <= points[i][j] <= 100
# @lc code=start
using LeetCode

function is_boomerang(points::Vector{Vector{Int}})
    p1, p2, p3 = points
    return (p1[1] - p2[1]) * (p1[2] - p3[2]) != (p1[1] - p3[1]) * (p1[2] - p2[2])
end
# @lc code=end
is_boomerang (generic function with 1 method)

This page was generated using DemoCards.jl and Literate.jl.