func exchange(_ nums: [Int]) -> [Int] {
var temp: [Int] = []
nums.forEach {
if $0 & 1 == 1 {
temp.insert($0, at: 0)
}
else {
temp.append($0)
}
}
return temp
}
func exchange1(_ nums: [Int]) -> [Int] {
var fastP: Int = 0
var slowP: Int = 0
var temp = nums
while fastP < nums.count {
if temp[fastP] & 1 == 1 {
temp.swapAt(fastP, slowP)
slowP += 1
}
fastP += 1
}
return temp
}