Infosys Interview Question

Asked one programming question. Question related to linked list