Whats the error plz check

one test case is not passsing

hello @mohitsingh

pls save ur code here->https://ide.codingblocks.com/

and share its link with me

relative order among even’s and odd’s must be same.
your code does not take care of that.
ex->
5
1 2 3 4 5

expected output
1 3 5 2 4

what should i change in this to debug this

we cant manitain relative order through this approach.

the idea to solve this problem is to maintain two seprate list one for even and one for odd .
and then append head of even to the tail of odd
and update the declare head of odd list and new head of original list

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.