当前位置:网站首页>力扣 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
边栏推荐
- 小试牛刀之NunJucks模板引擎
- Make this crmeb single merchant wechat mall system popular, so easy to use!
- MySQL、sqlserver oracle数据库连接方式
- PMP practice once a day | don't get lost in the exam -7.7
- Make insurance more "safe"! Kirin Xin'an one cloud multi-core cloud desktop won the bid of China Life Insurance, helping the innovation and development of financial and insurance information technolog
- 最多可以参加的会议数目[贪心 + 优先队列]
- R语言dplyr包select函数、group_by函数、filter函数和do函数获取dataframe中指定因子变量中指定水平中特定数值数据列的值第三大的值
- 841. 字符串哈希
- # 欢迎使用Markdown编辑器
- Navicat连接2002 - Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘解决
猜你喜欢
8 CAS
mock.js从对象数组中任选数据返回一个数组
Open source heavy ware! Chapter 9 the open source project of ylarn causal learning of Yunji datacanvas company will be released soon!
Make this crmeb single merchant wechat mall system popular, so easy to use!
Classification automatique des cellules de modules photovoltaïques par défaut dans les images de lecture électronique - notes de lecture de thèse
编译器优化那些事儿(4):归纳变量
Ways to improve the utilization of openeuler resources 01: Introduction
LeetCode力扣(剑指offer 36-39)36. 二叉搜索树与双向链表37. 序列化二叉树38. 字符串的排列39. 数组中出现次数超过一半的数字
Automatic classification of defective photovoltaic module cells in electroluminescence images-論文閱讀筆記
Empowering smart power construction | Kirin Xin'an high availability cluster management system to ensure the continuity of users' key businesses
随机推荐
Openeuler prize catching activities, to participate in?
MySQL、sqlserver oracle数据库连接方式
IP 工具类
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
Is PMP beneficial to work? How to choose a reliable platform to make it easier to prepare for the exam!!!
torch.nn.functional.pad(input, pad, mode=‘constant‘, value=None)记录
一锅乱炖,npm、yarn cnpm常用命令合集
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
LC: string conversion integer (ATOI) + appearance sequence + longest common prefix
Some arrangements about oneself
开源OA开发平台:合同管理使用手册
Make insurance more "safe"! Kirin Xin'an one cloud multi-core cloud desktop won the bid of China Life Insurance, helping the innovation and development of financial and insurance information technolog
8 CAS
AD域组策略管理
怎么在手机上买股票开户 股票开户安全吗
gorilla官方:golang开websocket client的示例代码
how to prove compiler‘s correctness
8 CAS
Nunjuks template engine
openEuler 资源利用率提升之道 01:概论