Files
leetcode/1037.valid-boomerang.java
2025-10-23 16:32:13 +08:00

26 lines
509 B
Java

/*
* @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