• + 1 comment

    I don't get whats wrong, the first test case always fails.

    bool compare_lists(SinglyLinkedListNode* head1, SinglyLinkedListNode* head2) {
    
        while(head1->next!=NULL && head2->next!=NULL)
        {
            if(head1->data!=head2->data)
            {
                return 0;
                break;
            }
                
            head1=head1->next;
            head2=head2->next;
        }
        return 1;
    }