Pergunta de entrevista da empresa ServiceNow

Alternate Linked List printing. Input : 1->2->3->4 Output : 1->4->2->3