当前位置:网站首页>Force buckle 1037 Effective boomerang
Force buckle 1037 Effective boomerang
2022-07-07 20:06:00 【Tomorrowave】
1037. Effective boomerang
Given an array points , among points[i] = [xi, yi] Express X-Y A point on the plane , If these points form a Boomerang Then return to true .
Boomerang Defined as a set of three points , These points Each are not identical And Not in a straight line .
Example 1:
Input :points = [[1,1],[2,3],[3,2]]
Output :true
Example 2:
Input :points = [[1,1],[2,2],[3,3]]
Output :false
Tips :
points.length == 3
points[i].length == 2
0 <= xi, yi <= 100
Ideas
Mathematical thought of three points collinear
Code section
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
边栏推荐
- 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
- 让这个 CRMEB 单商户微信商城系统火起来,太好用了!
- Make this crmeb single merchant wechat mall system popular, so easy to use!
- 8 CAS
- R语言dplyr包mutate_at函数和min_rank函数计算dataframe中指定数据列的排序序号值、名次值、将最大值的rank值赋值为1
- 使用高斯Redis实现二级索引
- 多个线程之间如何协同
- 干货分享|DevExpress v22.1原版帮助文档下载集合
- 831. KMP字符串
- ASP.NET学习& asp‘s one word
猜你喜欢
随机推荐
Mysql, sqlserver Oracle database connection mode
R语言ggplot2可视化:使用ggpubr包的ggqqplot函数可视化QQ图(Quantile-Quantile plot)
Chapter 9 Yunji datacanvas was rated as 36 krypton "the hard core technology enterprise most concerned by investors"
PMP每日一练 | 考试不迷路-7.7
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
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
Simulate the implementation of string class
关于cv2.dnn.readNetFromONNX(path)就报ERROR during processing node with 3 inputs and 1 outputs的解决过程【独家发布】
毕业季|遗憾而又幸运的毕业季
Automatic classification of defective photovoltaic module cells in electroluminescence images-论文阅读笔记
torch.nn.functional.pad(input, pad, mode=‘constant‘, value=None)记录
一文读懂数仓中的pg_stat
pom. Brief introduction of XML configuration file label function
Is PMP beneficial to work? How to choose a reliable platform to make it easier to prepare for the exam!!!
力扣 1961. 检查字符串是否为数组前缀
MRS离线数据分析:通过Flink作业处理OBS数据
Training IX basic configuration of network services
Some arrangements about oneself
Visual Studio 插件之CodeMaid自动整理代码
华南X99平台打鸡血教程