Intersection Point Of Linked Lists

easy
1. You are given a partially written LinkedList class.
2. You are required to complete the body of findIntersection function. The function is passed two linked lists which start separately but merge at a node and become common thereafter. The function is expected to find the point where two linked lists merge. You are not allowed to use arrays to solve the problem.
3. Input and Output is managed for you. 

<img src="http://pepcoding.com/resources/ojquestionresource/images/intersection-of-linked-list.jpeg" alt="intersection-of-linked-list">

Input Format

Input is managed for you

Output Format

Output is managed for you

Constraints

1. Time complexity -> O(n)
2. Space complexity -> constant

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
5
1 2 3 4 5
8
11 22 33 44 55 66 77 88
2
3
Output
44
Previous
Add Two Linked Lists

Related Questions