You are viewing a single comment's thread. Return to all comments →
Here is my c++ solution, you can watch the explanation here : https://youtu.be/sxWBiWg16JU
bool compare_lists(SinglyLinkedListNode* head1, SinglyLinkedListNode* head2) { while(head1 != nullptr && head2 !=nullptr) { if(head1->data != head2->data) return false; head1 = head1 ->next; head2 = head2 ->next; } return head2 == head1; }
Seems like cookies are disabled on this browser, please enable them to open this website
Compare two linked lists
You are viewing a single comment's thread. Return to all comments →
Here is my c++ solution, you can watch the explanation here : https://youtu.be/sxWBiWg16JU