Python | Two Pointers | O(n) Time |Explanation.
Success\nDetails \nRuntime: 228 ms, faster than 73.41% of Python3 online submissions for Sort Array By Parity II.\nMemory Usage: 16.1 MB, less than 91.62% of Py
<b>Success</b>\nDetails \nRuntime: 228 ms, faster than <b>73.41% </b>of Python3 online submissions for Sort Array By Parity II.\nMemory Usage: 16.1 MB, less than <b>91.62%</b> of Python3 online submissions for Sort Array By Parity II.\n\n\n1. Itterating i pointer over the array starting from zero and skipping one element so i will be always even.\n2. Check if the current element is odd or even\n3. If even we dont have to do anything\n4. if odd chek j pointer which was initillized at 1.\n5. Itterating j pointer over the array starting from one and skipping one element so i will be always odd.\n6. if jth element is even we have to swap jth element with ith.\n\n```\nclass Solution:\n    def sortArrayByParityII(self, nums: List[int]) -> List[int]:\n        j=1\n        for i in range(0,len(nums),2):\n            if nums[i]%2!=0:\n                while nums[j]%2!=0:\n                    j=j+2\n                nums[i],nums[j]=nums[j],nums[i]\n        return nums\n                \n```
['Two Pointers', 'Python']