当前位置:网站首页>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
边栏推荐
- Ucloud is a basic cloud computing service provider
- ASP.NET学习& asp‘s one word
- 时间工具类
- LeetCode力扣(剑指offer 36-39)36. 二叉搜索树与双向链表37. 序列化二叉树38. 字符串的排列39. 数组中出现次数超过一半的数字
- 九章云极DataCanvas公司获评36氪「最受投资人关注的硬核科技企业」
- SQL common optimization
- 【Confluence】JVM内存调整
- vulnhub之tre1
- Introduction to bit operation
- R language ggplot2 visualization: use the ggqqplot function of ggpubr package to visualize the QQ graph (Quantitative quantitative plot)
猜你喜欢
随机推荐
YoloV6:YoloV6+Win10---训练自己得数据集
MSE API学习
Cuda版本不一致,编译apex报错
831. KMP字符串
The state cyberspace Office released the measures for data exit security assessment: 100000 information provided overseas needs to be declared
数据孤岛是企业数字化转型遇到的第一道险关
ASP.NET学习& asp‘s one word
模拟实现string类
Visual Studio 插件之CodeMaid自动整理代码
力扣 1961. 检查字符串是否为数组前缀
R language uses ggplot2 function to visualize the histogram distribution of counting target variables that need to build Poisson regression model, and analyzes the feasibility of building Poisson regr
How to buy bank financial products? Do you need a bank card?
浏览积分设置的目的
torch.nn.functional.pad(input, pad, mode=‘constant‘, value=None)记录
Equals method
gorilla官方:golang开websocket client的示例代码
Tp6 realize Commission ranking
力扣 88.合并两个有序数组
Implement secondary index with Gaussian redis
【STL】vector