Even after odd linked list doubt

i questions like this can we just swap the data of two nodes or we need to swap the nodes ??

and this is a doubly-linked list question na ??

yes it is doubly linked list question
but swapping will not give correct output
because after swapping order of even and odd values will change which will lead to wrong ans

for input
2 4 3

after swapping your output will be
3 4 2
but correct output is
3 2 4

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.