feat: 2025-10-23打卡
This commit is contained in:
25
1037.valid-boomerang.java
Normal file
25
1037.valid-boomerang.java
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* @lc app=leetcode id=1037 lang=java
|
||||
*
|
||||
* [1037] Valid Boomerang
|
||||
*/
|
||||
|
||||
// @lc code=start
|
||||
class Solution {
|
||||
/**
|
||||
* y1 / x1 = y0 / x0
|
||||
* x0*y1 = x1*y0
|
||||
*
|
||||
* @param points
|
||||
* @return
|
||||
*/
|
||||
public boolean isBoomerang(int[][] points) {
|
||||
int x0 = points[1][0] - points[0][0];
|
||||
int y0 = points[1][1] - points[0][1];
|
||||
int x1 = points[2][0] - points[0][0];
|
||||
int y1 = points[2][1] - points[0][1];
|
||||
return x0 * y1 != x1 * y0;
|
||||
}
|
||||
}
|
||||
// @lc code=end
|
||||
|
||||
Reference in New Issue
Block a user