less than 1 minute read

Given two linked lists l0 and l1, return the two linked lists interleaved, starting with l0. If there are leftover nodes in a linked list, they should be added to the end.

Constraints

  • n ≤ 100,000 where n is the number of nodes in l0
  • m ≤ 100,000 where m is the number of nodes in l1

https://binarysearch.com/problems/Interleaved-Linked-List

Examples

Example 1

Input

  • l0 =
  • l1 =

Output

  • answer =

Example 2

Input

  • l0 =
  • l1 =

Output

  • answer =

Solution

Leave a comment