Skip to content

Commit 6d7b430

Browse files
authored
feat: add rust solution to lc problem: No.2553 (#1226)
1 parent a3eda81 commit 6d7b430

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

solution/2500-2599/2553.Separate the Digits in an Array/README.md

+24
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,30 @@ impl Solution {
176176
}
177177
```
178178

179+
```rust
180+
impl Solution {
181+
pub fn separate_digits(nums: Vec<i32>) -> Vec<i32> {
182+
let mut ans = vec![];
183+
184+
for n in nums {
185+
let mut t = vec![];
186+
let mut x = n;
187+
188+
while x != 0 {
189+
t.push(x % 10);
190+
x /= 10;
191+
}
192+
193+
for i in (0..t.len()).rev() {
194+
ans.push(t[i]);
195+
}
196+
}
197+
198+
ans
199+
}
200+
}
201+
```
202+
179203
### **C**
180204

181205
```c

solution/2500-2599/2553.Separate the Digits in an Array/README_EN.md

+24
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,30 @@ impl Solution {
162162
}
163163
```
164164

165+
```rust
166+
impl Solution {
167+
pub fn separate_digits(nums: Vec<i32>) -> Vec<i32> {
168+
let mut ans = vec![];
169+
170+
for n in nums {
171+
let mut t = vec![];
172+
let mut x = n;
173+
174+
while x != 0 {
175+
t.push(x % 10);
176+
x /= 10;
177+
}
178+
179+
for i in (0..t.len()).rev() {
180+
ans.push(t[i]);
181+
}
182+
}
183+
184+
ans
185+
}
186+
}
187+
```
188+
165189
### **C**
166190

167191
```c

0 commit comments

Comments
 (0)