Most easy way, Efficient approach, Beats 95%
Intuition\nAs soon as i saw the problem it was clear that we have to swap any unwanted element with respect to its index. i.e even element in odd index and odd 
# Intuition\nAs soon as i saw the problem it was clear that we have to swap any unwanted element with respect to its index. i.e even element in odd index and odd element in even index.\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nTwo pointers approach. Here we will take two pointers i and j, i is to find any odd element in even index, so i will start from 0 (i=0), j is to find even any element in odd index. When these both condition are true just swap i and j.\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 {\npublic:\n    vector<int> sortArrayByParityII(vector<int>& nums) {\n        int n=nums.size();\n        int i=0,j=1;\n        while(i<n && j<n)\n        {\n            while(i<n && nums[i]%2==0)\n                i+=2;\n            while(j<n && nums[j]%2!=0)\n                j+=2;\n            if(i<n)\n                swap(nums[i],nums[j]);\n            i+=2;j+=2;\n        }\n        return nums;\n    }\n};\n```
['C++']