当前位置:网站首页>力扣 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
边栏推荐
- Make this crmeb single merchant wechat mall system popular, so easy to use!
- How to buy stocks on your mobile phone and open an account? Is it safe to open an account
- 剑指 Offer II 013. 二维子矩阵的和
- 力扣 1961. 检查字符串是否为数组前缀
- Implement secondary index with Gaussian redis
- 【RT-Thread env 工具安装】
- R语言fpc包的dbscan函数对数据进行密度聚类分析、查看所有样本的聚类标签、table函数计算聚类簇标签与实际标签构成的二维列联表
- openEuler 有奖捉虫活动,来参与一下?
- Automatic classification of defective photovoltaic module cells in electroluminescence images-論文閱讀筆記
- R language dplyr package select function, group_ The by function, filter function and do function obtain the third largest value of a specific numerical data column in a specified level in a specified
猜你喜欢

小试牛刀之NunJucks模板引擎

J ü rgen schmidhub reviews the 25th anniversary of LSTM papers: long short term memory All computable metaverses. Hierarchical reinforcement learning (RL). Meta-RL. Abstractions in generative adversar

Classification automatique des cellules de modules photovoltaïques par défaut dans les images de lecture électronique - notes de lecture de thèse

mock. JS returns an array from the optional data in the object array

Implement secondary index with Gaussian redis

9 atomic operation class 18 Rohan enhancement

国家网信办公布《数据出境安全评估办法》:累计向境外提供10万人信息需申报

【STL】vector

# 欢迎使用Markdown编辑器

YoloV6:YoloV6+Win10---训练自己得数据集
随机推荐
R language ggplot2 visualization: use the ggecdf function of ggpubr package to visualize the grouping experience cumulative density distribution function curve, and the linetype parameter to specify t
爬虫实战(七):爬王者英雄图片
MySQL、sqlserver oracle数据库连接方式
# 欢迎使用Markdown编辑器
力扣 643. 子数组最大平均数 I
怎么在手机上买股票开户 股票开户安全吗
实训九 网络服务的基本配置
转置卷积理论解释(输入输出大小分析)
开源OA开发平台:合同管理使用手册
ASP.NET体育馆综合会员管理系统源码,免费分享
J ü rgen schmidhub reviews the 25th anniversary of LSTM papers: long short term memory All computable metaverses. Hierarchical reinforcement learning (RL). Meta-RL. Abstractions in generative adversar
我的创作纪念日
[sword finger offer] sword finger offer II 012 The sum of left and right subarrays is equal
华南X99平台打鸡血教程
Matplotlib drawing 3D graphics
银行理财产品怎么买?需要办银行卡吗?
强化学习-学习笔记8 | Q-learning
让这个 CRMEB 单商户微信商城系统火起来,太好用了!
R语言ggplot2可视化:使用ggpubr包的ggdensity函数可视化分组密度图、使用stat_overlay_normal_density函数为每个分组的密度图叠加正太分布曲线
pom.xml 配置文件标签:dependencies 和 dependencyManagement 区别