Problem in only one test case

I am getting error in only one test case in this question.
the link of my code:

@sanjit_15
you missed the case when ans doesn’t exist. you have to print “-1” in that case.
Simple substitute line 92 with
if(ans==NULL){ cout<<-1<<endl;}
else{ cout << ans->data << " "; }

Also in your intersection function check if any of head1 or head2 become NULL then return NULL. In that case ans doesn’t exist

The problem still persists…

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.

I am still getting this error:

runguard: warning: timelimit exceeded (wall time): aborting command
runguard: warning: command terminated with signal 15

@sanjit_15
Please share your latest code here.
Also , in the original code you shared I noticed that you have wrote most of your own code. Make sure that you are using the stub code of the actual problem. As you can see most of the code is written for you already and you only need to write a function. Use the problem stub.

Actually, this stub code feature was not present when I did this section 2-3 months ago… So we had to write the whole code by ourselves…Let me solve it again…If I face any problem, I’ll post it again…

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.