ques ->https://leetcode.com/problems/intersection-of-two-linked-lists/
ide->https://ide.codingblocks.com/s/204962
what is the problem in the code
ques ->https://leetcode.com/problems/intersection-of-two-linked-lists/
ide->https://ide.codingblocks.com/s/204962
what is the problem in the code
@mikkyimran
hello Imran,
dont compare node val ,compare addresses in pointer so above line should be
if(headA==headB )
why compare address and if we compare address why it is giving value at 8 but not at 1 ?
As 1 is present in both linked lists
the number written on node is data and not there adrresses.
u can see in above figure that 1 in B is equal to 1 in A but they are not intersecting ( having same value is not sufficient condition for intersection).
for intersection nodes should have same addresses (in the figure it is 8).