• + 0 comments

    @pvamsii43 what is the difference if you write the last else condition as given below?

                Node temp = headB;
        temp.next = headA;
        headA = temp;
                headB = headB.next;
        headA.next = mergeLists(headA.next, headB);
    

    I tried this code and it gave a non terminating output.