//url:https://leetcode.com/problems/sort-array-by-parity/
func sortArrayByParity(A []int) []int {
startIndex := 0
endIndex := len(A) - 1
for startIndex < endIndex {
if 0 != A[startIndex]%2 {
for startIndex < endIndex {
if 0 == A[endIndex]%2 {
fmt.Println("startIndex=", startIndex, ",endIndex=", endIndex, "swap:", A[startIndex], ",", A[endIndex])
tmp := A[startIndex]
A[startIndex] = A[endIndex]
A[endIndex] = tmp
endIndex--
break
}
endIndex--
}
}
startIndex++
}
return A
}