Valid Boomerang

EasyMathmath

Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.

Practice this as a mock interviewFree to start, no account needed

Problem

You are given points, an array of exactly three points on the plane, where points[i] = [x, y]. The three points form a **boomerang** when they are pairwise distinct and do not all lie on one straight line. Return true if they form a boomerang and false otherwise.

Examples

Input: points = [[1,1],[2,3],[3,2]]
Output: true
The three points are distinct and form a proper triangle.
Input: points = [[1,1],[2,2],[3,3]]
Output: false
All three sit on the line `y = x`.

Constraints

  • points.length == 3
  • points[i].length == 2
  • 0 <= x, y <= 100

What the interviewer grades

A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.

More math problems