C++ simple and short solution one pass
\nvector<int> sortArrayByParity(vector<int>& A) {\n\tfor (int i = 0, curEven = 0; i < A.size(); i++)\n\t\tif (A[i] % 2 == 0)\n\t\t\tswap(A[i], A[curEven++]);\n\
```\nvector<int> sortArrayByParity(vector<int>& A) {\n\tfor (int i = 0, curEven = 0; i < A.size(); i++)\n\t\tif (A[i] % 2 == 0)\n\t\t\tswap(A[i], A[curEven++]);\n\treturn A;\n}\n```\n
['C', 'C++']