Why my code i wrong at 2 test cases

Here is my code why it is wrong at 2 test cases , even there are no constraints on n.

Plz send your code by saving on ide, so that i could check it

Ayush, you have not written the function required for even odd in your code. Plz send the edited code.

at the time of build list i have done that,if it is odd then add at beginning and i it is even then add at tail

Ayush, your code seems to be incorrect in such test case :
5
1 3 5 7 9
Output should be : 1 3 5 7 9
Your output : 9 7 5 3 1

Try using some other approach only.