• + 0 comments

    Python solution:

    def compare_lists(llist1, llist2):

    current1=llist1
    current2=llist2
    flag=True
    while current1 and current2 and flag is True: 
        if current1.data != current2.data:
            flag=False
        current1=current1.next
        current2=current2.next
    
    if flag is True and current1==current2:
        return 1
    else:
        return 0