You are viewing a single comment's thread. Return to all comments →
Here is my c++ solution, you can watch video explanation here : https://youtu.be/F4nGusqPIu0
SinglyLinkedListNode* reverse(SinglyLinkedListNode* llist) { SinglyLinkedListNode* reverse = nullptr; while(llist != nullptr){ SinglyLinkedListNode* newNode = new SinglyLinkedListNode(llist->data); newNode ->next = reverse; reverse = newNode; llist = llist->next; } return reverse; }
Seems like cookies are disabled on this browser, please enable them to open this website
Reverse a linked list
You are viewing a single comment's thread. Return to all comments →
Here is my c++ solution, you can watch video explanation here : https://youtu.be/F4nGusqPIu0