Why doesnt the test cases pass?

@Anchal
Simply change Line No. 51 to “else” . That’s it.
Your code fails for a testcase where the two linked lists have a common element. Your code does not account for a case when a->data is equal to b->data .

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.