Even - After - Odd

To me the code seems to be perfect but it is failing for for 1 test case. I’m unable to find which test case am I missing out on. Can you pls help?

The link to my code is:

@priyanshi.agarwal3405
The relative order of the odd elements and even elements should remain the same after rearranging.

Input :
6
1 5 2 4 7 8

Expected Output :
1 5 7 2 4 8

Your Output :
1 5 7 4 2 8

Got it… Thank you :slight_smile: