You are viewing a single comment's thread. Return to all comments →
JAVA : Here is my Java resolution of this problem:
static int findMergeNode(SinglyLinkedListNode head1, SinglyLinkedListNode head2) { SinglyLinkedListNode head1_curr = head1; SinglyLinkedListNode head2_curr = head2; while((head1_curr != head2_curr)){ if(head1_curr.next == null){ head1_curr = head2; }else{ head1_curr= head1_curr.next; } if(head2_curr.next == null){ head2_curr = head1; }else{ head2_curr = head2_curr.next; } } return head2_curr.data; }
Seems like cookies are disabled on this browser, please enable them to open this website
Find Merge Point of Two Lists
You are viewing a single comment's thread. Return to all comments →
JAVA : Here is my Java resolution of this problem: