1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| import Foundation
func solution(_ num_list:[Int]) -> [Int] {
var even:[Int] = []
var odd:[Int] = []
for i in num_list {
// if i == 0 {
// even.append(i)
// }
if (i % 2) == 0 {
even.append(i)
}else {
odd.append(i)
}
}
return [even.count, odd.count]
}
|