C++ Solution || Simply Explained || Constant Space || Fast Algorithm
\nclass Solution {\n  public:\n    void reArrange(int arr[], int n) {\n        //I have tried writing a simple while-loop method to swap wrongly placed odd and 
```\nclass Solution {\n  public:\n    void reArrange(int arr[], int n) {\n        //I have tried writing a simple while-loop method to swap wrongly placed odd and wrongly placed even elements.\n        \n        int x = 0;\n        int y = 0;\n        \n        while(x<n && y<n){\n            \n            //wrongly placed odd\n            if(x%2==0 and arr[x]%2==1){\n                x++;\n            }\n            //rightly placed even\n            else if(x%2==0 and arr[x]%2==0){\n                x++;\n            }\n            //rightly placed odd\n            else if(x%2==1 and arr[x]%2==1){\n                x++;\n            }\n            \n            //wrongly placed even\n            if(y%2==1 and arr[y]%2==0){\n                y++;\n            }\n            //rightly placed even\n            else if(y%2==0 and arr[y]%2==0){\n                y++;\n            }\n            //rightly placed odd\n            else if(y%2==1 and arr[y]%2==1){\n                y++;\n            }\n            \n            //swap wrongly placed even and wrongly placed odd\n            if(x%2==1 and arr[x]%2==0 and y%2==0 and arr[y]%2==1){\n                swap(arr[x],arr[y]);\n                x++;\n                y++;\n            }\n        }\n    }\n};\n```\nDo upvote and comment. Thanks.
['Two Pointers', 'C']