You are viewing a single comment's thread. Return to all comments →
My solution with C++
bool compare_lists(SinglyLinkedListNode* head1, SinglyLinkedListNode* head2) { auto p1=head1; auto p2 = head2; while (p1!=nullptr&&p2!=nullptr&&p1->data==p2->data) { p1 = p1->next; p2 = p2->next; } if (p1==nullptr&&p2==nullptr) return 1; else return 0; }
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 →
My solution with C++