✅✅ Easy to understand CPP Solution 🚀🚀
\n# Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. O(n) \n\n
\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n/**\n * Definition for singly-linked list.\n * struct ListNode {\n *     int val;\n *     ListNode *next;\n *     ListNode() : val(0), next(nullptr) {}\n *     ListNode(int x) : val(x), next(nullptr) {}\n *     ListNode(int x, ListNode *next) : val(x), next(next) {}\n * };\n */\nclass Solution {\npublic:\n    ListNode* mergeInBetween(ListNode* list1, int a, int b, ListNode* list2) {\n        \n        ListNode * temp = list1;\n        ListNode *prev = NULL;\n\n        while(a--)\n        {\n            prev = temp;\n            temp = temp->next;\n        }\n\n        ListNode *temp2 =  list1;\n        ListNode *prev2 = NULL;\n\n        while(b--)\n        {\n            prev2 = temp2;\n            temp2 = temp2->next;\n        }\n\n        ListNode *demo = list2;\n\n        while(demo->next != NULL)\n        {\n            demo=demo->next;\n        }\n\n        demo->next = temp2->next;\n        prev2->next = NULL;\n\n        prev->next = list2;\n\n        return list1;\n    }\n};\n```
['Linked List', 'C++']