Please someone explain problem

Tags: #<Tag:0x00007f2421208ef0>


i didnt get the problem statement what we have to return exactly .can someone plz explain in detail


You need to return the node of intersection. You can traverse both linkedlist to a common node and if the the intersection is detected just return the node.


You are given two lists, l1 and l2. There is a node where the lists merge into one list. This node is called the intersection point. You need to find that node. It is kind of like finding the point where two roads merge and turn into one.

If such a point exists, then you know both of the lists contain a common sublist which we will call L. Then the lists can be rewritten this way:
l1 = l1’ -> L
l2 = l2’ -> L

That is, they can be thought of as two different prefix lists (namely l1’ and l2’) with the same suffix list (namely L). The two prefix lists might be different sizes. The point of intersection is the first node in L. I hope that makes sense!