🍀🍀 optimized || Neat Solution|| O(1) memory and O(n+m) space complexity
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``` python3 []\nclass Solution:\n    def mergeInBetween(self, list1: ListNode, a: int, b: int, list2: ListNode) -> ListNode:\n        temp1=list2\n        head=list1\n        pos=list2\n        end=list1\n        while list2.next:\n            list2=list2.next\n        i,j=0,0\n        while list1:\n            if i==a-1:\n                pos=list1\n            if j==b:\n                end=list1\n            i+=1\n            j+=1\n            list1=list1.next\n        pos.next=temp1\n        list2.next=end.next\n        return head\n```\n``` c++ []\nclass Solution {\npublic:\n    ListNode* mergeInBetween(ListNode* list1, int a, int b, ListNode* list2) {\n        ListNode *temp1=list2,*head=list1,*pos=list2,*end=list1;\n        while(list2->next)\n        {list2=list2->next;}\n        int i=0,j=0;\n        while(list1||i==a&&j==b)\n        {\n            if(i==a-1)\n            {pos=list1;}\n            if(j==b){\n                end=list1;\n            }\n            i++;j++;list1=list1->next;\n        }\n        pos->next=temp1;\n        list2->next=end->next;\n        return head;\n    }\n};\n```
['C++', 'Python3']