当前位置:网站首页>力扣 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
边栏推荐
- 一锅乱炖,npm、yarn cnpm常用命令合集
- 最多可以参加的会议数目[贪心 + 优先队列]
- 剑指 Offer II 013. 二维子矩阵的和
- Time tools
- Leetcode force buckle (Sword finger offer 36-39) 36 Binary search tree and bidirectional linked list 37 Serialize binary tree 38 Arrangement of strings 39 Numbers that appear more than half of the tim
- Browse the purpose of point setting
- 浏览积分设置的目的
- Version selection of boot and cloud
- R语言ggplot2可视化:使用ggpubr包的ggdensity函数可视化分组密度图、使用stat_overlay_normal_density函数为每个分组的密度图叠加正太分布曲线
- Mysql, sqlserver Oracle database connection mode
猜你喜欢
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
转置卷积理论解释(输入输出大小分析)
LeetCode_ 7_ five
Ways to improve the utilization of openeuler resources 01: Introduction
ASP.NET幼儿园连锁管理系统源码
mock. JS returns an array from the optional data in the object array
RESTAPI 版本控制策略【eolink 翻译】
使用高斯Redis实现二级索引
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
关于cv2.dnn.readNetFromONNX(path)就报ERROR during processing node with 3 inputs and 1 outputs的解决过程【独家发布】
随机推荐
力扣 2315.统计星号
What does "true" mean
MSE API学习
【STL】vector
vulnhub之school 1
实训九 网络服务的基本配置
ant desgin 多选
equals 方法
【剑指offer】剑指 Offer II 012. 左右两边子数组的和相等
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
ASP. Net kindergarten chain management system source code
Training IX basic configuration of network services
MySQL、sqlserver oracle数据库连接方式
2022年投资哪个理财产品收益高?
Notes...
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
微信公众号OAuth2.0授权登录并显示用户信息
网信办公布《数据出境安全评估办法》,9 月 1 日起施行
编译器优化那些事儿(4):归纳变量
Semantic SLAM源码解析