We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
that is a lie. i fixed my code by allowing search for head it answered correctly.
c++ solution:
intfindMergeNode(SinglyLinkedListNode*head1,SinglyLinkedListNode*head2){autofirst=head1;autosecond=head2;while(first!=second){first=(first->next)?first->next:head2;second=(second->next)?second->next:head1;}// no merge, should never happendif(first==nullptr)throw-1;returnfirst->data;}
Cookie support is required to access HackerRank
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 →
The Constraint LIES:
that is a lie. i fixed my code by allowing search for head it answered correctly.
c++ solution: