yeah i know not the most optimal solution but iam running late so gtg bye
Intuition\n Describe your first thoughts on how to solve this problem. \njust basic cutting and joining\n# Approach\n Describe your approach to solving the prob
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\njust basic cutting and joining\n# Approach\n<!-- Describe your approach to solving the problem. -->\nwe use dummy linked lists to make copies whenever needed\nwe cut the linked list at the pointer \nwe get the linked list that should be joined \nand attach it to the end of the first linked list \nsee the code youll get it\nif not comment down \n# Complexity\n- Time complexity:O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(N)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n/**\n * Definition for singly-linked list.\n * function ListNode(val, next) {\n *     this.val = (val===undefined ? 0 : val)\n *     this.next = (next===undefined ? null : next)\n * }\n */\n/**\n * @param {ListNode} list1\n * @param {number} a\n * @param {number} b\n * @param {ListNode} list2\n * @return {ListNode}\n */\nvar mergeInBetween = function(list1, a, b, list2) {\n    let counter=0\n    let dummy = list1\n    for(let i=0;i<b+1;i++){\n        dummy=dummy.next\n    }\n    //console.log(dummy)\n    let traveladapter = function(ll,p,idx){\n        if(p==idx){\n            ll.next=list2\n        }\n        else{\n            traveladapter(ll.next,p+1,idx)\n        }\n    }\n    traveladapter(list1,0,a-1)\n    //console.log(list1)\n    let traveller = function(ll1,ll2){\n        if(ll1.next){\n            traveller(ll1.next,ll2)\n        }\n        else{\n            ll1.next=ll2\n        }\n    }\n    traveller(list1,dummy)\n    return list1\n    \n    \n\n};\n```
['JavaScript']