当前位置:网站首页>力扣 1037.有效的回旋镖
力扣 1037.有效的回旋镖
2022-07-07 17:53:00 【Tomorrowave】
1037.有效的回旋镖
给定一个数组 points ,其中 points[i] = [xi, yi] 表示 X-Y 平面上的一个点,如果这些点构成一个 回旋镖 则返回 true 。
回旋镖 定义为一组三个点,这些点 各不相同 且 不在一条直线上 。
示例 1:
输入:points = [[1,1],[2,3],[3,2]]
输出:true
示例 2:
输入:points = [[1,1],[2,2],[3,3]]
输出:false
提示:
points.length == 3
points[i].length == 2
0 <= xi, yi <= 100
思路
三点共线的数学思想
代码部分
class Solution:
def isBoomerang(self, points: List[List[int]]) -> bool:
o=points[0]
points[1][0]-=points[0][0]
points[1][1] -= points[0][1]
points[2][0] -= points[0][0]
points[2][1] -= points[0][1]
res=points[1][0]*points[2][1]-points[1][1]*points[2][0]
return res !=0
边栏推荐
- Kirin Xin'an with heterogeneous integration cloud financial information and innovation solutions appeared at the 15th Hunan Financial Technology Exchange Conference
- openEuler 有奖捉虫活动,来参与一下?
- A pot of stew, a collection of common commands of NPM and yarn cnpm
- 9 atomic operation class 18 Rohan enhancement
- 841. String hash
- 银行理财产品怎么买?需要办银行卡吗?
- 时间工具类
- 使用高斯Redis实现二级索引
- Sword finger offer II 013 Sum of two-dimensional submatrix
- Browse the purpose of point setting
猜你喜欢
【STL】vector
最多可以参加的会议数目[贪心 + 优先队列]
LeetCode_ 7_ five
Redis——基本使用(key、String、List、Set 、Zset 、Hash、Geo、Bitmap、Hyperloglog、事务 )
openEuler 资源利用率提升之道 01:概论
Automatic classification of defective photovoltaic module cells in electroluminescence images-論文閱讀筆記
Introduction to bit operation
The state cyberspace Office released the measures for data exit security assessment: 100000 information provided overseas needs to be declared
Cloud 组件发展升级
# 欢迎使用Markdown编辑器
随机推荐
R语言dplyr包mutate_at函数和min_rank函数计算dataframe中指定数据列的排序序号值、名次值、将最大值的rank值赋值为1
2022年投资哪个理财产品收益高?
Semantic SLAM源码解析
R语言dplyr包select函数、group_by函数、filter函数和do函数获取dataframe中指定因子变量中指定水平中特定数值数据列的值第三大的值
tp6 实现佣金排行榜
Semantic slam source code analysis
Is PMP beneficial to work? How to choose a reliable platform to make it easier to prepare for the exam!!!
Implement secondary index with Gaussian redis
Training IX basic configuration of network services
转置卷积理论解释(输入输出大小分析)
Kirin Xin'an joins Ningxia commercial cipher Association
The research group of the Hunan Organizing Committee of the 24th China Association for science and technology visited Kirin Xin'an
[sword finger offer] sword finger offer II 012 The sum of left and right subarrays is equal
LeetCode力扣(剑指offer 36-39)36. 二叉搜索树与双向链表37. 序列化二叉树38. 字符串的排列39. 数组中出现次数超过一半的数字
Tp6 realize Commission ranking
“本真”是什么意思
Simulate the implementation of string class
注解。。。
831. KMP字符串
A pot of stew, a collection of common commands of NPM and yarn cnpm