欢迎光临散文网 会员登陆 & 注册

LeetCode 1037. Valid Boomerang

2023-04-01 11:53 作者:您是打尖儿还是住店呢  | 我要投稿

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

  • 就是判断斜率是否相等,相等了,那么就不能组成三角形了,easy题目;

Runtime: 0 ms, faster than 100.00% of Java online submissions for Valid Boomerang.

Memory Usage: 39.9 MB, less than 68.82% of Java online submissions for Valid Boomerang.


LeetCode 1037. Valid Boomerang的评论 (共 条)

分享到微博请遵守国家法律