当前位置:网站首页>[leetcode] day 48 - 1037 Effective boomerang
[leetcode] day 48 - 1037 Effective boomerang
2022-06-09 03:48:00 【1 + 1= Wang】
1037. Effective boomerang
Title Description

Their thinking
I didn't expect to encounter a pure mathematical problem .
So-called “ Effective boomerang ” It means that the three points given are not on the same straight line .
- Two vectors can be calculated from three points
- The three points are not on the same straight line , That is, the two vectors are not parallel , That is, cross multiplication is not 0.
Code implementation
class Solution {
public boolean isBoomerang(int[][] points) {
// Calculate the first vector
int x1=points[1][0]-points[0][0],y1=points[1][1]-points[0][1];
// Calculate the second vector
int x2=points[2][0]-points[0][0],y2=points[2][1]-points[0][1];
// The vector cross product is not 0
return (x1*y2-x2*y1)!=0;
}
}
边栏推荐
- GC日志分析
- Please ask about the SQL injection problem
- [reinforcement learning notes] V value and Q value in reinforcement learning
- Is CICC wealth safe? I want to open an account
- Six C language final assignments KTV song selection, personal revenue and expenditure management, staff resource management, class student file management, product information management, library mana
- C language interview tube: talk about the functions of various string functions. I: I don't know. Interviewer: come back for an interview when the young man has learned how to do it.
- The students of Turing class of Peking University won the first place in the global undergraduate competition and solved the EDA "neck sticking" technical problem!
- OnlineJudge instructions
- On June 12, MSG enterprise bank focused on Langfang AI enterprises to promote the integrated development of "double chain"
- 复杂查询 指什么,包括哪些
猜你喜欢

It becomes obsolete when you use it ~websecurityconfigureradapter

Zhongang Mining: fluorite resources listed in the strategic mineral catalogue

Tree storage structure -- three different tree representations

网页设计期末作业-xxx公司网站(含导航栏轮播图等等)

分布式 | dble 读写分离场景下为什么普通的读 sql 发送到了 master 实例上

『C语言』面试管:说下各个字符串函数功能,我:不知道。面试官:小伙子学会了再来面试吧。

OnlineJudge instructions

GC日志分析

Merkle Patricia Trie原理

技术分享 | 调整 max-write-buffer-size 优化 pika 性能10倍的案例
随机推荐
Introduction to related operations of Huawei cloud sandbox Lab
2022年【电商】测试优惠券如何编写测试用例?
Technology sharing | adjusting Max write buffer size to optimize the performance of pika by 10 times
JVM内存查看及设置思路
网页设计期末作业-xxx公司网站(含导航栏轮播图等等)
[share] network packet loss fault handling scheme
ArcGIS Runtime 离线gdb数据缺失问题处理
Fault analysis - a case of excessive CPU load caused by a large number of short-time processes
Mongodb builds replica set cluster
Use of rich text boxes
Laravel view access routes
Five highlights of wwdc2022 lock screen, weather kit, swiftui, collaboration function, apple payment
Tree storage structure -- three different tree representations
互联网寒冬?软件测试人员如何逆势而行进入高薪大厂
内存飙升问题定位
Why common read SQL is sent to the master instance in the distributed dble read / write separation scenario
On June 12, MSG enterprise bank focused on Langfang AI enterprises to promote the integrated development of "double chain"
With a monthly salary of nearly 10000 yuan and 3 years of career change test as a sales assistant, how can I get multiple offers with 0 experience?
印尼Widya Robotics携手华为云,让建筑工地安全看得见
How to use superset to seamlessly connect with MRS for self-service analysis