Pergunta de entrevista da empresa Yelp

Write a function which reverses a linked list.

Resposta da entrevista

Sigiloso

5 de mai. de 2016

Node * reverse(Node *head){ Node * prev=head; Node *curr=head->next; Node * next=head->next->next; while(next!=NULL){ curr->next=prev; prev=curr; curr=next; next=next->next; } return curr; }

1