当前位置:网站首页>力扣 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
边栏推荐
- 【STL】vector
- Classification automatique des cellules de modules photovoltaïques par défaut dans les images de lecture électronique - notes de lecture de thèse
- R语言使用ggplot2函数可视化需要构建泊松回归模型的计数目标变量的直方图分布并分析构建泊松回归模型的可行性
- The strength index of specialized and new software development enterprises was released, and Kirin Xin'an was honored on the list
- Compiler optimization (4): inductive variables
- 力扣 1232.缀点成线
- Kirin Xin'an joins Ningxia commercial cipher Association
- Navicat连接2002 - Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘解决
- R语言fpc包的dbscan函数对数据进行密度聚类分析、查看所有样本的聚类标签、table函数计算聚类簇标签与实际标签构成的二维列联表
- vulnhub之Funfox2
猜你喜欢

微信公众号OAuth2.0授权登录并显示用户信息

Compiler optimization (4): inductive variables

LeetCode力扣(剑指offer 36-39)36. 二叉搜索树与双向链表37. 序列化二叉树38. 字符串的排列39. 数组中出现次数超过一半的数字

转置卷积理论解释(输入输出大小分析)

Empowering smart power construction | Kirin Xin'an high availability cluster management system to ensure the continuity of users' key businesses

谷歌seo外链Backlinks研究工具推荐

ASP.NET幼儿园连锁管理系统源码

【STL】vector

Kirin Xin'an cloud platform is newly upgraded!

Classification automatique des cellules de modules photovoltaïques par défaut dans les images de lecture électronique - notes de lecture de thèse
随机推荐
Implement secondary index with Gaussian redis
how to prove compiler‘s correctness
R语言dplyr包select函数、group_by函数、filter函数和do函数获取dataframe中指定因子变量中指定水平中特定数值数据列的值第三大的值
关于自身的一些安排
Ways to improve the utilization of openeuler resources 01: Introduction
网信办公布《数据出境安全评估办法》,9 月 1 日起施行
一锅乱炖,npm、yarn cnpm常用命令合集
Chapter 9 Yunji datacanvas was rated as 36 krypton "the hard core technology enterprise most concerned by investors"
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
强化学习-学习笔记8 | Q-learning
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!!!
openEuler 有奖捉虫活动,来参与一下?
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
Nunjuks template engine
8 CAS
How to cooperate among multiple threads
Kunpeng developer summit 2022 | Kirin Xin'an and Kunpeng jointly build a new ecosystem of computing industry
The state cyberspace Office released the measures for data exit security assessment: 100000 information provided overseas needs to be declared
【剑指offer】剑指 Offer II 012. 左右两边子数组的和相等
ASP.NET幼儿园连锁管理系统源码