当前位置:网站首页>LeetCode:1037. Effective boomerang - simple
LeetCode:1037. Effective boomerang - simple
2022-06-10 20:49:00 【Kinght_ one hundred and twenty-three】

Catalog
subject
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
Their thinking

- mathematics .
- If three points are collinear , Then the cross product of any two vectors is equal to 0.
Code
class Solution:
def isBoomerang(self, points: List[List[int]]) -> bool:
v1 = (points[1][0] - points[0][0], points[1][1] - points[0][1])
v2 = (points[2][0] - points[0][0], points[2][1] - points[0][1])
return v1[0] * v2[1] - v1[1] * v2[0] != 0
Running results

边栏推荐
- 4.35v lithium battery charging IC
- 国庆期间给大家推荐一个可能会成为2019最佳的CRUD工具
- User defined date component. The left and right buttons control forward or backward year, month, week and day turning
- Kp522201a adopts SOT23-6 encapsulated 4.5V to 17V input, 2A output, 600kHz synchronous step-down converter
- 力扣1082,1084题解_sql查询类型的题目
- CVPR 2022丨清华大学提出:无监督域泛化 (UDG)
- Qualcomm qc2.0 fast charging intelligent identification IC fp6719
- 电子招标采购商城系统:优化传统采购业务,提速企业数字化升级
- [observation] shengteng Zhixing: scene driven, innovation first, press the "acceleration key" for Intelligent Transportation
- 「Bug」问题分析 RuntimeError:which is output 0 of ReluBackward0
猜你喜欢

Elastic-Job的快速入门,三分钟带你体验分布式定时任务

C语言 浮点数 储存形式

一个10年左右的老程序员说:简单CRUD功能进入无码开发时代1 之 增删改查接口信息

Key points of lldp protocol preparation

Recommend a crud tool that may become the best crud tool in 2019 during the National Day

2台电脑共享一套键盘鼠标

Kcon 2022 topic public selection is hot! Don't miss the topic of "favorite"

8.4v dual lithium battery professional charging IC (fs4062a)

Microsoft Word 教程「5」,如何在 Word 中更改页边距、创建新闻稿栏?

pytorch深度学习——卷积操作以及代码示例
随机推荐
Knowledge map / relationship visualization
C language floating point number storage form
MySQL Basics
Elastic-Job的快速入门,三分钟带你体验分布式定时任务
在阿里云国际上使用 OSS 和 CDN 部署静态网站
Stacked bar graph move the mouse into the tooltip to prompt that the filter is 0 element, so as to realize custom bubbles
8.4v dual lithium battery professional charging IC (fs4062a)
为什么网页样式属性,有的需要加冒号“:”,有的不用?
User defined date component. The left and right buttons control forward or backward year, month, week and day turning
The excess part of the table setting is hidden. Move the mouse to display all
How to use Diablo immortal database
Microsoft Word tutorial "5", how to change the margins and create a newsletter column in word?
【电脑使用】如何设置没有自启项的软件开机启动
JS basic and frequently asked interview questions [] = =! [] result is true, [] = = [] result is false detailed explanation
Standing at such a time node today, we may have a clearer understanding of the industrial Internet
[observation] shengteng Zhixing: scene driven, innovation first, press the "acceleration key" for Intelligent Transportation
2 pcs share a set of keyboard and mouse
35岁被裁员,还能拥有美妙人生吗?
In MySQL basics, MySQL adds an automatically added primary key (or any field) to an existing table
Recommend a crud tool that may become the best crud tool in 2019 during the National Day