当前位置:网站首页>力扣 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
边栏推荐
- 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
- 关于ssh登录时卡顿30s左右的问题调试处理
- Le PGR est - il utile au travail? Comment choisir une plate - forme fiable pour économiser le cœur et la main - d'œuvre lors de la préparation de l'examen!!!
- MIT科技评论文章:围绕Gato等模型的AGI炒作可能使人们忽视真正重要的问题
- 831. KMP字符串
- Detailed explanation of Flink parallelism and slot
- CSDN语法说明
- The research group of the Hunan Organizing Committee of the 24th China Association for science and technology visited Kirin Xin'an
- 关于自身的一些安排
- torch. nn. functional. Pad (input, pad, mode= 'constant', value=none) record
猜你喜欢
Ways to improve the utilization of openeuler resources 01: Introduction
Compiler optimization (4): inductive variables
vulnhub之Funfox2
PMP對工作有益嗎?怎麼選擇靠譜平臺讓備考更省心省力!!!
mock.js从对象数组中任选数据返回一个数组
8 CAS
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
编译器优化那些事儿(4):归纳变量
开源OA开发平台:合同管理使用手册
The project manager's "eight interview questions" is equal to a meeting
随机推荐
The DBSCAN function of FPC package of R language performs density clustering analysis on data, checks the clustering labels of all samples, and the table function calculates the two-dimensional contin
R language ggplot2 visualization: use the ggstripchart function of ggpubr package to visualize the dot strip plot, set the position parameter, and configure the separation degree of different grouped
IP 工具类
9 原子操作类之18罗汉增强
sql 常用优化
openEuler 资源利用率提升之道 01:概论
My creation anniversary
位运算介绍
mock. JS returns an array from the optional data in the object array
开源重器!九章云极DataCanvas公司YLearn因果学习开源项目即将发布!
Matplotlib drawing 3D graphics
力扣 2315.统计星号
一张图深入的理解FP/FN/Precision/Recall
Make this crmeb single merchant wechat mall system popular, so easy to use!
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
pom.xml 配置文件标签:dependencies 和 dependencyManagement 区别
Automatic classification of defective photovoltaic module cells in electroluminescence images-論文閱讀筆記
Detailed explanation of Flink parallelism and slot
831. KMP字符串
Ways to improve the utilization of openeuler resources 01: Introduction