SMARTEST Solution with JAVA(beats 99% / 90%) 1.way
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int[] sortArrayByParityII(int[] nums) {\n        int odd = 1;\n        int even = 0;\n        int[] ret = new int[nums.length];\n        for(int a: nums){\n            if(a%2==0){\n                ret[even] = a;\n                even += 2;\n            }else{\n                ret[odd] = a;\n                odd+=2;\n            }\n        }\n        return ret;\n    }\n}\n```
['Java']