当前位置:网站首页>力扣 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
边栏推荐
- ASP.NET幼儿园连锁管理系统源码
- sql 常用优化
- vulnhub之Funfox2
- R语言使用ggplot2函数可视化需要构建泊松回归模型的计数目标变量的直方图分布并分析构建泊松回归模型的可行性
- 9 atomic operation class 18 Rohan enhancement
- 841. 字符串哈希
- 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
- 2022年投资哪个理财产品收益高?
- Visual Studio 插件之CodeMaid自动整理代码
- LeetCode_7_5
猜你喜欢
随机推荐
R语言fpc包的dbscan函数对数据进行密度聚类分析、查看所有样本的聚类标签、table函数计算聚类簇标签与实际标签构成的二维列联表
Visual Studio 插件之CodeMaid自动整理代码
The state cyberspace Office released the measures for data exit security assessment: 100000 information provided overseas needs to be declared
pom.xml 配置文件标签作用简述
PMP practice once a day | don't get lost in the exam -7.7
Simulate the implementation of string class
Browse the purpose of point setting
Introduction to bit operation
【Confluence】JVM内存调整
RESTAPI 版本控制策略【eolink 翻译】
力扣 2315.统计星号
Kirin Xin'an won the bid for the new generation dispatching project of State Grid!
开源OA开发平台:合同管理使用手册
[RT thread env tool installation]
R language ggplot2 visualization: use the ggdensity function of ggpubr package to visualize the packet density graph, and use stat_ overlay_ normal_ The density function superimposes the positive dist
一锅乱炖,npm、yarn cnpm常用命令合集
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
R语言使用ggplot2函数可视化需要构建泊松回归模型的计数目标变量的直方图分布并分析构建泊松回归模型的可行性
The strength index of specialized and new software development enterprises was released, and Kirin Xin'an was honored on the list
让这个 CRMEB 单商户微信商城系统火起来,太好用了!









