File tree 4 files changed +62
-0
lines changed
solution/1000-1099/1037.Valid Boomerang
4 files changed +62
-0
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,30 @@ func isBoomerang(points [][]int) bool {
99
99
}
100
100
```
101
101
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
+
102
126
### ** ...**
103
127
104
128
```
Original file line number Diff line number Diff line change @@ -76,6 +76,30 @@ func isBoomerang(points [][]int) bool {
76
76
}
77
77
```
78
78
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
+
79
103
### ** ...**
80
104
81
105
```
Original file line number Diff line number Diff line change
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 number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments