[easy understanding][c++][explained]
\n//list1 = [0,1,2,3,4,5], a = 3, b = 4, list2 = [1000000,1000001,1000002]\nclass Solution {\npublic:\n    ListNode* mergeInBetween(ListNode* list1, int a, int 
```\n//list1 = [0,1,2,3,4,5], a = 3, b = 4, list2 = [1000000,1000001,1000002]\nclass Solution {\npublic:\n    ListNode* mergeInBetween(ListNode* list1, int a, int b, ListNode* list2) {\n        ListNode* prev,*tail,*head=list1;\n        int x=a-1;\n        while(x--) head=head->next; \n\t\t//prev and head is at index=3 i.e. val=2 of list1\n        prev=head;\n        b=b-a+1; //node that we have to delete\n        while(b--) head=head->next;\n\t\t//know head is at index=5 i.e. val=4 of list1\n        tail=head->next; //tail is at index=6 i.e. val=5 of list1 \n        head->next=NULL;\n\t\t//merge list2 in list1 with prev\n        prev->next=list2;\n        while(prev->next!=NULL){\n            prev=prev->next;\n        }\n\t\t//prev is the know the last element of list2\n\t\t//join it with list1(tail)\n        prev->next=tail;\n        return list1;\n    }\n};\n```\n**Feel free to ask any question in the comment section.**\nI hope that you\'ve found the solution useful.\nIn that case, **please do upvote and encourage me** to on my quest to document all leetcode problems\uD83D\uDE03\nHappy Coding :)\n
['C', 'C++']