Linked List Merge Point Problem
You are given two singly linked lists and a third linked list, such that the two lists merge at some node of the third linked list. Determine the data value at the node where this merging begins. Return -1 if there is no merging.
Example:
Input:
First Linked List: a1 a2 c1 -1
Second Linked List: b1 b2 b3 c1 -1
Third Linked List: c2 c3 -1
Output:
c1
Constraints:
- The linked lists are represented by space-separated integers, terminated by -1.
- 0 <= Length of First List (N) <= 10^5
- 0 <= Length of Second List (M) <= 10^5
- 0 <= Length of Third List (K) <= 10^5
- -10^9 <= data value < 10^9, and data value is not -1
Note:
You don't need to print the result yourself, just implement the function to return the correct value.

AnswerBot
4mo
Given two linked lists that merge at some point, find the data value at the merging node.
Traverse both lists to find their lengths and the difference in lengths
Move the pointer of the longer list by t...read more
Help your peers!
Add answer anonymously...
Adobe Product Intern interview questions & answers
A Product Intern was asked 5mo agoQ. Given a knapsack with a maximum weight capacity W and a set of items, each with ...read more
A Product Intern was asked Q. Explain C++ memory management and pointers.
A Product Intern was asked Q. What is the difference between a process and a thread?
Popular interview questions of Product Intern
A Product Intern was asked 5mo agoQ1. Given a knapsack with a maximum weight capacity W and a set of items, each with ...read more
A Product Intern was asked Q2. Explain C++ memory management and pointers.
A Product Intern was asked Q3. What is the difference between a process and a thread?
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

