How will we take input in intersection point two linked lists question

like we are making two lists how will we merge it

In this question, you are not required to merge the list, rather you have to take two head pointers, and build both these list separately,. and then make their lengths same by traversing the linked list with longer length upto the difference of their length. After that , since length becomes same, you need to check that
if (a->data!=b->data)
{
a=a->next;
b=b->next;
}
else
{
return a->data;
}

For further explanation, plz refer to online lecture hint given .

1 Like


this code is showing wrong output … why?

i found my mistake and thanks for the help