当前位置:网站首页>力扣 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
边栏推荐
- 关于cv2.dnn.readNetFromONNX(path)就报ERROR during processing node with 3 inputs and 1 outputs的解决过程【独家发布】
- 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
- 841. String hash
- The DBSCAN function of FPC package of R language performs density clustering analysis on data, checks the clustering labels of all samples, and the table function calculates the two-dimensional contin
- Kirin Xin'an won the bid for the new generation dispatching project of State Grid!
- AD域组策略管理
- PMP對工作有益嗎?怎麼選擇靠譜平臺讓備考更省心省力!!!
- Implement secondary index with Gaussian redis
- 831. KMP string
- equals 方法
猜你喜欢

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

Automatic classification of defective photovoltaic module cells in electroluminescence images-论文阅读笔记

【RT-Thread env 工具安装】

mysql 的一些重要知识

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

vulnhub之tre1

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

PMP practice once a day | don't get lost in the exam -7.7
Make this crmeb single merchant wechat mall system popular, so easy to use!

Flink并行度和Slot详解
随机推荐
Automatic classification of defective photovoltaic module cells in electroluminescence images-论文阅读笔记
The state cyberspace Office released the measures for data exit security assessment: 100000 information provided overseas needs to be declared
# 欢迎使用Markdown编辑器
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!!!
Mysql, sqlserver Oracle database connection mode
mock.js从对象数组中任选数据返回一个数组
干货分享|DevExpress v22.1原版帮助文档下载集合
Openeuler prize catching activities, to participate in?
使用高斯Redis实现二级索引
vulnhub之Funfox2
IP tools
华南X99平台打鸡血教程
R language ggplot2 visualization: use the ggqqplot function of ggpubr package to visualize the QQ graph (Quantitative quantitative plot)
Welcome to the markdown editor
Empowering smart power construction | Kirin Xin'an high availability cluster management system to ensure the continuity of users' key businesses
R语言dplyr包mutate_at函数和min_rank函数计算dataframe中指定数据列的排序序号值、名次值、将最大值的rank值赋值为1
openEuler 有奖捉虫活动,来参与一下?
MySQL、sqlserver oracle数据库连接方式
Dynamic addition of El upload upload component; El upload dynamically uploads files; El upload distinguishes which component uploads the file.
Implement secondary index with Gaussian redis