• + 1 comment

    You are right. We can just have:

    if(headA == NULL){
        return headB;
    } else if(headB == NULL){
        return headA;
    }
    
    • + 1 comment
      [deleted]
      • + 0 comments

        here is problem solution in python java c++ and c programming. https://solution.programmingoneonone.com/2020/07/hackerrank-merge-two-sorted-linked-lists-solution.html