当前位置:网站首页>力扣 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
边栏推荐
- A pot of stew, a collection of common commands of NPM and yarn cnpm
- 转置卷积理论解释(输入输出大小分析)
- YoloV6:YoloV6+Win10---训练自己得数据集
- R语言ggplot2可视化:使用ggpubr包的ggdensity函数可视化分组密度图、使用stat_overlay_normal_density函数为每个分组的密度图叠加正太分布曲线
- R语言ggplot2可视化:使用ggpubr包的ggqqplot函数可视化QQ图(Quantile-Quantile plot)
- LC: string conversion integer (ATOI) + appearance sequence + longest common prefix
- PMP practice once a day | don't get lost in the exam -7.7
- 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
- Kubernetes——kubectl命令行工具用法详解
- pom.xml 配置文件标签:dependencies 和 dependencyManagement 区别
猜你喜欢

Kirin Xin'an with heterogeneous integration cloud financial information and innovation solutions appeared at the 15th Hunan Financial Technology Exchange Conference

openEuler 有奖捉虫活动,来参与一下?
让这个 CRMEB 单商户微信商城系统火起来,太好用了!

8 CAS

小试牛刀之NunJucks模板引擎

Open source heavy ware! Chapter 9 the open source project of ylarn causal learning of Yunji datacanvas company will be released soon!

模拟实现string类

Interpretation of transpose convolution theory (input-output size analysis)

Sword finger offer II 013 Sum of two-dimensional submatrix

Kirin Xin'an won the bid for the new generation dispatching project of State Grid!
随机推荐
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
vulnhub之school 1
openEuler 资源利用率提升之道 01:概论
转置卷积理论解释(输入输出大小分析)
PMP对工作有益吗?怎么选择靠谱平台让备考更省心省力!!!
What does "true" mean
强化学习-学习笔记8 | Q-learning
实训九 网络服务的基本配置
Classification automatique des cellules de modules photovoltaïques par défaut dans les images de lecture électronique - notes de lecture de thèse
The research group of the Hunan Organizing Committee of the 24th China Association for science and technology visited Kirin Xin'an
RESTAPI 版本控制策略【eolink 翻译】
2022年投资哪个理财产品收益高?
equals 方法
How to buy bank financial products? Do you need a bank card?
Specify the version of OpenCV non-standard installation
torch.nn.functional.pad(input, pad, mode=‘constant‘, value=None)记录
项目经理『面试八问』,看了等于会了
Semantic SLAM源码解析
2022如何评估与选择低代码开发平台?
【RT-Thread env 工具安装】