Run error in intersection point of two LinkedList

in one of the test case out of 4 it is showing run error
my code----->>>>

Pls add some comments in your intersection function so that I could understand your approach…

well approach is similar to that used in the hint video
still i have added comments


@yuktimutreja01

I have edited your intersection function… The code was giving runtime error for the test case, when there is no intersection point… So since you were returning the node in case when there was no intersection point, it was giving runtime error… So instead, I have edited by returning the data of the node… if the intersection point is there, else it returns -1…