You are viewing a single comment's thread. Return to all comments →
My Solution in Java
static boolean compareLists(SinglyLinkedListNode head1, SinglyLinkedListNode head2) { SinglyLinkedListNode current1 = head1; SinglyLinkedListNode current2 = head2; while(current1 != null && current2 != null){ if(current1.data == current2.data){ current1 = current1.next; current2 = current2.next; }else{ return false; } } if(current1 == null && current2 == null)return true; return false;
}
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 in Java