当前位置:网站首页>力扣 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
边栏推荐
- CSDN语法说明
- Semantic SLAM源码解析
- Interpretation of transpose convolution theory (input-output size analysis)
- 【RT-Thread env 工具安装】
- Jürgen Schmidhuber回顾LSTM论文等发表25周年:Long Short-Term Memory. All computable metaverses. Hierarchical reinforcement learning (RL). Meta-RL. Abstractions in generative adversarial RL. Soccer learn
- Introduction to bit operation
- ASP. Net kindergarten chain management system source code
- Open source heavy ware! Chapter 9 the open source project of ylarn causal learning of Yunji datacanvas company will be released soon!
- torch. nn. functional. Pad (input, pad, mode= 'constant', value=none) record
- Classification automatique des cellules de modules photovoltaïques par défaut dans les images de lecture électronique - notes de lecture de thèse
猜你喜欢
Empowering smart power construction | Kirin Xin'an high availability cluster management system to ensure the continuity of users' key businesses
【RT-Thread env 工具安装】
[RT thread env tool installation]
RESTAPI 版本控制策略【eolink 翻译】
Openeuler prize catching activities, to participate in?
AD域组策略管理
Chapter 9 Yunji datacanvas was rated as 36 krypton "the hard core technology enterprise most concerned by investors"
九章云极DataCanvas公司摘获「第五届数字金融创新大赛」最高荣誉!
Navicat连接2002 - Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘解决
el-upload上传组件的动态添加;el-upload动态上传文件;el-upload区分文件是哪个组件上传的。
随机推荐
Cloud 组件发展升级
MIT科技评论文章:围绕Gato等模型的AGI炒作可能使人们忽视真正重要的问题
2022如何评估与选择低代码开发平台?
PMP practice once a day | don't get lost in the exam -7.7
ant desgin 多选
LeetCode_7_5
Boot 和 Cloud 的版本选型
Automatic classification of defective photovoltaic module cells in electroluminescence images-論文閱讀筆記
【STL】vector
R语言ggplot2可视化:使用ggpubr包的ggqqplot函数可视化QQ图(Quantile-Quantile plot)
vulnhub之tre1
sql 常用优化
LeetCode_ 7_ five
Open source heavy ware! Chapter 9 the open source project of ylarn causal learning of Yunji datacanvas company will be released soon!
Dynamic addition of El upload upload component; El upload dynamically uploads files; El upload distinguishes which component uploads the file.
R language dplyr package mutate_ At function and min_ The rank function calculates the sorting sequence number value and ranking value of the specified data column in the dataframe, and assigns the ra
The project manager's "eight interview questions" is equal to a meeting
Simulate the implementation of string class
vulnhub之school 1
# 欢迎使用Markdown编辑器