In this question cant we just push_front in one case and push_back in other

in this question cant we just push_front in one case and push_back in other ?

No order will change that way though u can mantain two different linked list and its even then push in first one and if its odd then push in 2nd one
and finally join them

But u are expected to divide the already formed linked list
so my suggestion is first form a linked list and then seperate odd and even and then join them

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.