1
impl Solution {
2
pub fn sort_array_by_parity(nums: Vec<i32>) -> Vec<i32> {
3
let mut even = Vec::new();
4
let mut odd = Vec::new();
5

6
for num in nums {
7
if num % 2 == 0 {
8
even.push(num);
9
} else {
10
odd.push(num);
11
}
12
}
13

14
even.extend(odd);
15
even
16
}
17
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0