Why it is giving different o/p?

@kailash_01
hello Kailash,
your logic is not correct.
you are just printing difference between the length of two linked list.
but in question u r asked to print node value where the two linked list intersect. also it might happen that the two given list never intersect in that case u need to print -1.

refer this algorithm->
image