You are viewing a single comment's thread. Return to all comments →
constrain should mention that data would be positive only, or did I just find a bug :P
int findMergeNode(SinglyLinkedListNode* head1, SinglyLinkedListNode* head2) { SinglyLinkedListNode *ptr = head1; while (ptr) { ptr -> data = -1*(ptr->data); ptr = ptr -> next; } ptr = head2; while (ptr) { if(ptr->data<0) return -1*(ptr->data); ptr = ptr->next; } return -1; }
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 →
constrain should mention that data would be positive only, or did I just find a bug :P