less than 1 minute read

Given two sorted linked lists l0, and l1, return a new sorted linked list containing the intersection of the two lists.

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/Linked-List-Intersection

Examples

Example 1

Input

  • l0 =
  • l1 =

Output

  • answer =

Example 2

Input

  • l0 =
  • l1 =

Output

  • answer =

Solution

Leave a comment