Simple JAVA Solution || Beats 100%
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: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 * public class ListNode {\n *     int val;\n *     ListNode next;\n *     ListNode() {}\n *     ListNode(int val) { this.val = val; }\n *     ListNode(int val, ListNode next) { this.val = val; this.next = next; }\n * }\n */\nclass Solution {\n    public ListNode mergeInBetween(ListNode list1, int a, int b, ListNode list2) {\n        ListNode cur=list1;\n\n        for(int i=0;i<a-1;i++){\n            cur=cur.next;\n        } \n\n        ListNode start_from_here=cur;\n\n        for(int i=a;i<=b+1;i++){\n            cur=cur.next;\n            // now my linked list pointer is at 5\n        }\n        \n    start_from_here.next=list2;\n       while(list2.next!=null){\n         list2=list2.next;\n       }\n        // connect the second list to the first after removing the interval\n       list2.next=cur;\n\n       return list1;\n\n    }\n}\n```
['Java']