Java | faster than 99.63%
\nclass Solution {\n    \n    void swap(int[] A, int i, int j){\n         int tmp = A[i];\n         A[i] = A[j];\n         A[j] = tmp;\n    }\n    \n    public 
```\nclass Solution {\n    \n    void swap(int[] A, int i, int j){\n         int tmp = A[i];\n         A[i] = A[j];\n         A[j] = tmp;\n    }\n    \n    public int[] sortArrayByParityII(int[] A) {\n        int odd_p = 1;\n        int n = A.length;\n        \n        for(int i=0;i<n;i+=2){\n            if(A[i]%2 == 1){\n                while(A[odd_p]%2 == 1)\n                    odd_p += 2;\n                swap(A, i, odd_p);\n            }\n        }\n        \n        return A;\n    }\n}\n```
['Java']