c++ || beats 96%
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\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 */\n#pragma GCC optimize("O3", "unroll-loops")\nclass Solution {\npublic:\n    ListNode* mergeInBetween(ListNode* list1, int a, int b, ListNode* list2) {\n        ListNode* head=list1, *curr=list1;\n        for(int i=1; i<a; i++)\n            curr=curr->next;\n\n        ListNode* rm_start = curr; // node before the section to be removed\n        ListNode* rm_end = curr->next; // first node to be removed\n        \n        // Move rm_end to the last node of the section to be removed\n        for (int i= a; i<=b; i++) {\n            ListNode* tmp = rm_end;\n            rm_end = rm_end->next;\n            delete tmp; // Deallocate memory for each removed node\n        }\n\n        // Connect the remaining part of list1 to list2\n        rm_start->next = list2;\n        \n        // Move curr to the end of list2\n        for (; curr->next; curr=curr->next);\n           \n        \n        // Connect the remaining part of list1 after the removed section\n        curr->next = rm_end;\n        \n        return head;\n    }\n};\n\n\nauto init = []() {\n    ios::sync_with_stdio(0);\n    cin.tie(0);\n    cout.tie(0);\n    return \'c\';\n}();\n```
['C++']