What is the reason for time limit exceed

i think it’s of the order O(n)already
“here is the link”

hello @saurabh66

a)

here use l1!=null and l2!=null (Otherwise for empty list ur code will give segmentation fault)

b)
image

in ur while loop add these conditions ie
temp1!=NULL && temp2!=NULL && temp1!=temp2 (note i m using temp1!=temp2 because then it will be easy to handle)

in return simply do temp1;