You are viewing a single comment's thread. Return to all comments →
Nice solution. For the first three checks, you can simplify to:
if (headA==NULL): return headB; if (headB==NULL): return headA;
Because if they are both null, this will just return null which is what we want. But if only one is null, it will return the other.
Seems like cookies are disabled on this browser, please enable them to open this website
Merge two sorted linked lists
You are viewing a single comment's thread. Return to all comments →
Nice solution. For the first three checks, you can simplify to:
Because if they are both null, this will just return null which is what we want. But if only one is null, it will return the other.