Skip to content

Commit f7b1900

Browse files
committed
feat: add solutions to lc problem: No.1037
No.1037.Valid Boomerang
1 parent ef2d89d commit f7b1900

File tree

4 files changed

+62
-0
lines changed

4 files changed

+62
-0
lines changed

solution/1000-1099/1037.Valid Boomerang/README.md

+24
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,30 @@ func isBoomerang(points [][]int) bool {
9999
}
100100
```
101101

102+
### **TypeScript**
103+
104+
```ts
105+
function isBoomerang(points: number[][]): boolean {
106+
const [x1, y1] = points[0];
107+
const [x2, y2] = points[1];
108+
const [x3, y3] = points[2];
109+
return (x1 - x2) * (y2 - y3) !== (x2 - x3) * (y1 - y2);
110+
}
111+
```
112+
113+
### **Rust**
114+
115+
```rust
116+
impl Solution {
117+
pub fn is_boomerang(points: Vec<Vec<i32>>) -> bool {
118+
let (x1, y1) = (points[0][0], points[0][1]);
119+
let (x2, y2) = (points[1][0], points[1][1]);
120+
let (x3, y3) = (points[2][0], points[2][1]);
121+
(x1 - x2) * (y2 - y3) != (x2 - x3) * (y1 - y2)
122+
}
123+
}
124+
```
125+
102126
### **...**
103127

104128
```

solution/1000-1099/1037.Valid Boomerang/README_EN.md

+24
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,30 @@ func isBoomerang(points [][]int) bool {
7676
}
7777
```
7878

79+
### **TypeScript**
80+
81+
```ts
82+
function isBoomerang(points: number[][]): boolean {
83+
const [x1, y1] = points[0];
84+
const [x2, y2] = points[1];
85+
const [x3, y3] = points[2];
86+
return (x1 - x2) * (y2 - y3) !== (x2 - x3) * (y1 - y2);
87+
}
88+
```
89+
90+
### **Rust**
91+
92+
```rust
93+
impl Solution {
94+
pub fn is_boomerang(points: Vec<Vec<i32>>) -> bool {
95+
let (x1, y1) = (points[0][0], points[0][1]);
96+
let (x2, y2) = (points[1][0], points[1][1]);
97+
let (x3, y3) = (points[2][0], points[2][1]);
98+
(x1 - x2) * (y2 - y3) != (x2 - x3) * (y1 - y2)
99+
}
100+
}
101+
```
102+
79103
### **...**
80104

81105
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
impl Solution {
2+
pub fn is_boomerang(points: Vec<Vec<i32>>) -> bool {
3+
let (x1, y1) = (points[0][0], points[0][1]);
4+
let (x2, y2) = (points[1][0], points[1][1]);
5+
let (x3, y3) = (points[2][0], points[2][1]);
6+
(x1 - x2) * (y2 - y3) != (x2 - x3) * (y1 - y2)
7+
}
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
function isBoomerang(points: number[][]): boolean {
2+
const [x1, y1] = points[0];
3+
const [x2, y2] = points[1];
4+
const [x3, y3] = points[2];
5+
return (x1 - x2) * (y2 - y3) !== (x2 - x3) * (y1 - y2);
6+
}

0 commit comments

Comments
 (0)