c++ | clean code | explained | easy to understand
I have used 3 pointers for the soution of this problem one pointer will be one node behind the point of merging in list 1 and second pointer will be on node ahe
I have used 3 pointers for the soution of this problem one pointer will be one node behind the point of merging in list 1 and second pointer will be on node ahead of the last point of merging. My 3rd pointer will be at the last point of my list 2 and then after having these 3 pointers we can perform the merge operation like a piece of cake.\n\n\n```\nListNode* mergeInBetween(ListNode* list1, int a, int b, ListNode* list2) {\n        a=a-1;\n        b=b+1;\n        ListNode *start=list1;\n        ListNode *end=list1;\n        ListNode *tail=list2;\n        while(a--)\n        {\n            start=start->next;\n        }\n        while(b--)\n        {\n            end=end->next;\n        }\n        while(tail->next!=NULL)\n        {\n            tail=tail->next;\n        }\n        start->next=list2;\n        tail->next=end;\n        \n        \n        return list1;\n    }\n    ```
['C']