Problem Statement
You’re given the pointer to the head nodes of two linked lists that merge together at some node. Find the node at which this merger happens. The two head nodes will be different and neither will be NULL.
[List #1] a--->b--->c--> x--->y--->z--->NULL / [List #2] p--->q-->x-->y-->z
In the above figure, both list merges at node x.
Input Format You have to complete the int FindMergeNode(Node* headA, Node* headB) method which takes two arguments - the heads of the linked lists. You should NOT read any input from stdin/console.
Output Format Find the node at which both lists merge and return the data of that node. Do NOT print anything to stdout/console.
No comments:
Post a Comment