Tap here to switch tabs
Problem
Submissions

Problem: Merge In Between Linked Lists

med
30 min
Try to solve the Merge In Between Linked Lists problem.

Statement

You are given two singly linked lists list1 and list2, along with two integers a and b. Modify list1 in place by removing the contiguous segment of nodes from index a through index b inclusive, using 00 based indexing. Then splice the entire linked list list2 into list1 at the position where that segment was removed.

Return the head of the updated linked list.

The method signature is ListNode mergeInBetween(ListNode list1, int a, int b, ListNode list2).

Constraints:

  • 3≤3 \leq list1.length ≤104\leq 10^4

  • 1≤1 \leq a ≤\leq b << list1.length −1- 1

  • 1≤1 \leq list2.length ≤104\leq 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Merge In Between Linked Lists

med
30 min
Try to solve the Merge In Between Linked Lists problem.

Statement

You are given two singly linked lists list1 and list2, along with two integers a and b. Modify list1 in place by removing the contiguous segment of nodes from index a through index b inclusive, using 00 based indexing. Then splice the entire linked list list2 into list1 at the position where that segment was removed.

Return the head of the updated linked list.

The method signature is ListNode mergeInBetween(ListNode list1, int a, int b, ListNode list2).

Constraints:

  • 3≤3 \leq list1.length ≤104\leq 10^4

  • 1≤1 \leq a ≤\leq b << list1.length −1- 1

  • 1≤1 \leq list2.length ≤104\leq 10^4