Rearranging elements

Given a singly linked list L : L0→L1→…→Ln-1→Ln . Rearrange the nodes in the list so that the new formed list is : L0→Ln→L1→Ln-1→L2→Ln-2→…
You are required do this in-place without altering the nodes’ values.
You just need to return the head of new linked list, don’t print the elements.
error is coming

In your code, you have not build the Node class. Your code seems incomplete.
You can refer this

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.