You are viewing a single comment's thread. Return to all comments →
simple python solution:
def compare_lists(llist1, llist2): while llist1 and llist2: if llist1.data != llist2.data: return False llist1 = llist1.next llist2 = llist2.next if (not llist1 and llist2) or (llist1 and not llist2): return False return True
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Compare two linked lists
You are viewing a single comment's thread. Return to all comments →
simple python solution: