当前位置:网站首页>力扣 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
边栏推荐
- [confluence] JVM memory adjustment
- mock. JS returns an array from the optional data in the object array
- 剑指 Offer II 013. 二维子矩阵的和
- 凌云出海记 | 赛盒&华为云:共助跨境电商行业可持续发展
- R language ggplot2 visualization: use the ggviolin function of ggpubr package to visualize the violin diagram, set the palette parameter to customize the filling color of violin diagrams at different
- R语言fpc包的dbscan函数对数据进行密度聚类分析、查看所有样本的聚类标签、table函数计算聚类簇标签与实际标签构成的二维列联表
- 关于cv2.dnn.readNetFromONNX(path)就报ERROR during processing node with 3 inputs and 1 outputs的解决过程【独家发布】
- Jürgen Schmidhuber回顾LSTM论文等发表25周年:Long Short-Term Memory. All computable metaverses. Hierarchical reinforcement learning (RL). Meta-RL. Abstractions in generative adversarial RL. Soccer learn
- 841. 字符串哈希
- Kirin Xin'an with heterogeneous integration cloud financial information and innovation solutions appeared at the 15th Hunan Financial Technology Exchange Conference
猜你喜欢

Redis——基本使用(key、String、List、Set 、Zset 、Hash、Geo、Bitmap、Hyperloglog、事务 )

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

RESTAPI 版本控制策略【eolink 翻译】

The strength index of specialized and new software development enterprises was released, and Kirin Xin'an was honored on the list

8 CAS

Introduction to bit operation
![[RT thread env tool installation]](/img/bc/9b39651d40a240f0893200793f67e9.png)
[RT thread env tool installation]
Make this crmeb single merchant wechat mall system popular, so easy to use!

模拟实现string类

Chapter 9 Yunji datacanvas was rated as 36 krypton "the hard core technology enterprise most concerned by investors"
随机推荐
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
让这个 CRMEB 单商户微信商城系统火起来,太好用了!
ASP. Net kindergarten chain management system source code
ASP. Net gymnasium integrated member management system source code, free sharing
[sword finger offer] sword finger offer II 012 The sum of left and right subarrays is equal
【STL】vector
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
Kirin Xin'an cloud platform is newly upgraded!
位运算介绍
Browse the purpose of point setting
mock.js从对象数组中任选数据返回一个数组
mysql 的一些重要知识
Openeuler prize catching activities, to participate in?
Flink并行度和Slot详解
Matplotlib drawing 3D graphics
Simulate the implementation of string class
The state cyberspace Office released the measures for data exit security assessment: 100000 information provided overseas needs to be declared
openEuler 资源利用率提升之道 01:概论
浏览积分设置的目的
pom.xml 配置文件标签:dependencies 和 dependencyManagement 区别