2ms in java very easiest code 😊.
Code
![94da60ee-7268-414c-b977-2403d3530840_1725903127.9303432.png](https://assets.leetcode.com/users/images/fb90aebd-40ce-40ac-9bec-e440917570d2_1736494002.0009239.png)


# Code
```java []
class Solution {
    public int[] sortArrayByParityII(int[] nums) {

       int[] arr = new int[nums.length];
        short e = 0, o = 1;

        for (int num : nums) {
            if (num % 2 == 0){
                arr[e] = num;
                e += 2;
            }else {
                arr[o] = num;
                o += 2;
            }
        }
        return arr;
    }
}
```
['Java']