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:
points.length == 3
points[i].length == 2
0 <= points[i][j] <= 100
二.解题思路
在不在一条直线上其实就是斜率相等,主要就是注意一下/0的情况
三个点在一条竖线上或者有2个点相等都会出现/0的异常
三个点在一天横线和一条竖线比较容易处理我就直接单独拿出来判断
其他的就判断斜率是否相同了
更多leetcode算法题解法请关注我的专栏leetcode算法从零到结束或关注我
欢迎大家一起套路一起刷题一起ac