File tree 4 files changed +52
-0
lines changed
solution/1200-1299/1295.Find Numbers with Even Number of Digits
4 files changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,16 @@ function findNumbers(nums: number[]): number {
131
131
}
132
132
```
133
133
134
+ #### Rust
135
+
136
+ ``` rust
137
+ impl Solution {
138
+ pub fn find_numbers (nums : Vec <i32 >) -> i32 {
139
+ nums . iter (). filter (| & x | x . to_string (). len () % 2 == 0 ). count () as i32
140
+ }
141
+ }
142
+ ```
143
+
134
144
#### JavaScript
135
145
136
146
``` js
@@ -143,6 +153,16 @@ var findNumbers = function (nums) {
143
153
};
144
154
```
145
155
156
+ #### C#
157
+
158
+ ``` cs
159
+ public class Solution {
160
+ public int FindNumbers (int [] nums ) {
161
+ return nums .Count (x => x .ToString ().Length % 2 == 0 );
162
+ }
163
+ }
164
+ ```
165
+
146
166
<!-- tabs: end -->
147
167
148
168
<!-- solution: end -->
Original file line number Diff line number Diff line change @@ -129,6 +129,16 @@ function findNumbers(nums: number[]): number {
129
129
}
130
130
```
131
131
132
+ #### Rust
133
+
134
+ ``` rust
135
+ impl Solution {
136
+ pub fn find_numbers (nums : Vec <i32 >) -> i32 {
137
+ nums . iter (). filter (| & x | x . to_string (). len () % 2 == 0 ). count () as i32
138
+ }
139
+ }
140
+ ```
141
+
132
142
#### JavaScript
133
143
134
144
``` js
@@ -141,6 +151,16 @@ var findNumbers = function (nums) {
141
151
};
142
152
```
143
153
154
+ #### C#
155
+
156
+ ``` cs
157
+ public class Solution {
158
+ public int FindNumbers (int [] nums ) {
159
+ return nums .Count (x => x .ToString ().Length % 2 == 0 );
160
+ }
161
+ }
162
+ ```
163
+
144
164
<!-- tabs: end -->
145
165
146
166
<!-- solution: end -->
Original file line number Diff line number Diff line change
1
+ impl Solution {
2
+ pub fn find_numbers ( nums : Vec < i32 > ) -> i32 {
3
+ nums. iter ( )
4
+ . filter ( |& x| x. to_string ( ) . len ( ) % 2 == 0 )
5
+ . count ( ) as i32
6
+ }
7
+ }
Original file line number Diff line number Diff line change
1
+ public class Solution {
2
+ public int FindNumbers ( int [ ] nums ) {
3
+ return nums . Count ( x => x . ToString ( ) . Length % 2 == 0 ) ;
4
+ }
5
+ }
You can’t perform that action at this time.
0 commit comments