JAVA| faster than 99%
\tclass Solution {\n    public int[] sortArrayByParityII(int[] nums) {\n        int oddindex = 1;\n       int evenindex = 0;\n       int res[] = new int[nums.le
\tclass Solution {\n    public int[] sortArrayByParityII(int[] nums) {\n        int oddindex = 1;\n       int evenindex = 0;\n       int res[] = new int[nums.length];\n        for (int i = 0; i < nums.length; i++) {\n            if (nums[i]%2==0) {\n                res[evenindex]=nums[i];\n                evenindex+=2;\n            }\n            else\n            {\n                res[oddindex]=nums[i];\n                oddindex+=2;\n            }\n        }\n        return res;\n    }\n}
['Java']