Apple Interview Question

Reverse a Linked List

Interview Answer

Anonymous

May 16, 2021

if(Head == NULL) return; Node* current, prev, next; current = next = Head; prev = NULL; while(current) { next = current ->next; current -> next = prev; prev = current; current = next; }