Related Articles

# Intersection of two Sorted Linked Lists

• Difficulty Level : Medium
• Last Updated : 18 Jun, 2021

Given two lists sorted in increasing order, create and return a new list representing the intersection of the two lists. The new list should be made with its own memory — the original lists should not be changed.

Example:

```Input:
Output: 2->4->6.
The elements 2, 4, 6 are common in
both the list so they appear in the
intersection list.

Input:
Output: 2->3->4
The elements 2, 3, 4 are common in
both the list so they appear in the
intersection list.```

Method 1: Using Dummy Node.
Approach:
The idea is to use a temporary dummy node at the start of the result list. The pointer tail always points to the last node in the result list, so new nodes can be added easily. The dummy node initially gives the tail a memory space to point to. This dummy node is efficient, since it is only temporary, and it is allocated in the stack. The loop proceeds, removing one node from either ‘a’ or ‘b’ and adding it to the tail. When the given lists are traversed the result is in dummy. next, as the values are allocated from next node of the dummy. If both the elements are equal then remove both and insert the element to the tail. Else remove the smaller element among both the lists.

Below is the implementation of the above approach:

## C++

 `#include``using` `namespace` `std;` `/* Link list node */``struct` `Node {``    ``int` `data;``    ``Node* next;``};` `void` `push(Node** head_ref, ``int` `new_data);` `/*This solution uses the temporary`` ``dummy to build up the result list */``Node* sortedIntersect(Node* a, Node* b)``{``    ``Node dummy;``    ``Node* tail = &dummy;``    ``dummy.next = NULL;` `    ``/* Once one or the other``    ``list runs out -- we're done */``    ``while` `(a != NULL && b != NULL) {``        ``if` `(a->data == b->data) {``            ``push((&tail->next), a->data);``            ``tail = tail->next;``            ``a = a->next;``            ``b = b->next;``        ``}``        ``/* advance the smaller list */``        ``else` `if` `(a->data < b->data)``            ``a = a->next;``        ``else``            ``b = b->next;``    ``}``    ``return` `(dummy.next);``}` `/* UTILITY FUNCTIONS */``/* Function to insert a node at``the beginning of the linked list */``void` `push(Node** head_ref, ``int` `new_data)``{``    ``/* allocate node */``    ``Node* new_node = (Node*)``malloc``(``        ``sizeof``(Node));` `    ``/* put in the data  */``    ``new_node->data = new_data;` `    ``/* link the old list off the new node */``    ``new_node->next = (*head_ref);` `    ``/* move the head to point to the new node */``    ``(*head_ref) = new_node;``}` `/* Function to print nodes in``   ``a given linked list */``void` `printList(Node* node)``{``    ``while` `(node != NULL) {``        ``cout << node->data <<``" "``;``        ``node = node->next;``    ``}``}` `/* Driver program to test above functions*/``int` `main()``{``    ``/* Start with the empty lists */``    ``Node* a = NULL;``    ``Node* b = NULL;``    ``Node* intersect = NULL;` `    ``/* Let us create the first sorted``     ``linked list to test the functions``     ``Created linked list will be``     ``1->2->3->4->5->6 */``    ``push(&a, 6);``    ``push(&a, 5);``    ``push(&a, 4);``    ``push(&a, 3);``    ``push(&a, 2);``    ``push(&a, 1);` `    ``/* Let us create the second sorted linked list``   ``Created linked list will be 2->4->6->8 */``    ``push(&b, 8);``    ``push(&b, 6);``    ``push(&b, 4);``    ``push(&b, 2);` `    ``/* Find the intersection two linked lists */``    ``intersect = sortedIntersect(a, b);` `    ``cout<<``"Linked list containing common items of a & b \n"``;``    ``printList(intersect);``}`

## C

 `#include ``#include ` `/* Link list node */``struct` `Node {``    ``int` `data;``    ``struct` `Node* next;``};` `void` `push(``struct` `Node** head_ref, ``int` `new_data);` `/*This solution uses the temporary`` ``dummy to build up the result list */``struct` `Node* sortedIntersect(``    ``struct` `Node* a,``    ``struct` `Node* b)``{``    ``struct` `Node dummy;``    ``struct` `Node* tail = &dummy;``    ``dummy.next = NULL;` `    ``/* Once one or the other``    ``list runs out -- we're done */``    ``while` `(a != NULL && b != NULL) {``        ``if` `(a->data == b->data) {``            ``push((&tail->next), a->data);``            ``tail = tail->next;``            ``a = a->next;``            ``b = b->next;``        ``}``        ``/* advance the smaller list */``        ``else` `if` `(a->data < b->data)``            ``a = a->next;``        ``else``            ``b = b->next;``    ``}``    ``return` `(dummy.next);``}` `/* UTILITY FUNCTIONS */``/* Function to insert a node at``the beginning of the linked list */``void` `push(``struct` `Node** head_ref, ``int` `new_data)``{``    ``/* allocate node */``    ``struct` `Node* new_node = (``struct` `Node*)``malloc``(``        ``sizeof``(``struct` `Node));` `    ``/* put in the data  */``    ``new_node->data = new_data;` `    ``/* link the old list off the new node */``    ``new_node->next = (*head_ref);` `    ``/* move the head to point to the new node */``    ``(*head_ref) = new_node;``}` `/* Function to print nodes in``   ``a given linked list */``void` `printList(``struct` `Node* node)``{``    ``while` `(node != NULL) {``        ``printf``(``"%d "``, node->data);``        ``node = node->next;``    ``}``}` `/* Driver program to test above functions*/``int` `main()``{``    ``/* Start with the empty lists */``    ``struct` `Node* a = NULL;``    ``struct` `Node* b = NULL;``    ``struct` `Node* intersect = NULL;` `    ``/* Let us create the first sorted``     ``linked list to test the functions``     ``Created linked list will be``     ``1->2->3->4->5->6 */``    ``push(&a, 6);``    ``push(&a, 5);``    ``push(&a, 4);``    ``push(&a, 3);``    ``push(&a, 2);``    ``push(&a, 1);` `    ``/* Let us create the second sorted linked list``   ``Created linked list will be 2->4->6->8 */``    ``push(&b, 8);``    ``push(&b, 6);``    ``push(&b, 4);``    ``push(&b, 2);` `    ``/* Find the intersection two linked lists */``    ``intersect = sortedIntersect(a, b);` `    ``printf``(``"\n Linked list containing common items of a & b \n "``);``    ``printList(intersect);` `    ``getchar``();``}`

## Java

 `class` `GFG``{``  ` `    ``// head nodes for pointing to 1st and 2nd linked lists``    ``static` `Node a = ``null``, b = ``null``;``  ` `    ``// dummy node for storing intersection``    ``static` `Node dummy = ``null``;``  ` `    ``// tail node for keeping track of``  ``// last node so that it makes easy for insertion``    ``static` `Node tail = ``null``;``    ` `    ``// class - Node``    ``static` `class` `Node {``        ``int` `data;``        ``Node next;` `        ``Node(``int` `data) {``            ``this``.data = data;``            ``next = ``null``;``        ``}``    ``}``    ` `    ``// function for printing the list``    ``void` `printList(Node start) {``        ``Node p = start;``        ``while` `(p != ``null``) {``            ``System.out.print(p.data + ``" "``);``            ``p = p.next;``        ``}``        ``System.out.println();``    ``}``    ` `    ``// inserting elements into list``    ``void` `push(``int` `data) {``        ``Node temp = ``new` `Node(data);``        ``if``(dummy == ``null``) {``            ``dummy = temp;``            ``tail = temp;``        ``}``        ``else` `{``            ``tail.next = temp;``            ``tail = temp;``        ``}``    ``}``    ` `    ``// function for finding intersection and adding it to dummy list``    ``void` `sortedIntersect()``    ``{``      ` `        ``// pointers for iterating``        ``Node p = a,q = b;``        ``while``(p != ``null`  `&&  q != ``null``)``        ``{``            ``if``(p.data == q.data)``            ``{``                ``// add to dummy list``                ``push(p.data);``                ``p = p.next;``                ``q = q.next;``            ``}``            ``else` `if``(p.data < q.data)``                ``p = p.next;``            ``else``                ``q= q.next;``        ``}``    ``}``    ` `  ``// Driver code``    ``public` `static` `void` `main(String args[])``    ``{``        ``GFG list = ``new` `GFG();``        ` `        ``// creating first linked list``        ``list.a = ``new` `Node(``1``);``        ``list.a.next = ``new` `Node(``2``);``        ``list.a.next.next = ``new` `Node(``3``);``        ``list.a.next.next.next = ``new` `Node(``4``);``        ``list.a.next.next.next.next = ``new` `Node(``6``);` `        ``// creating second linked list``        ``list.b = ``new` `Node(``2``);``        ``list.b.next = ``new` `Node(``4``);``        ``list.b.next.next = ``new` `Node(``6``);``        ``list.b.next.next.next = ``new` `Node(``8``);``        ` `        ``// function call for intersection``        ``list.sortedIntersect();``      ` `        ``// print required intersection``        ``System.out.println(``"Linked list containing common items of a & b"``);``        ``list.printList(dummy);``    ``}``}` `// This code is contributed by Likhita AVL`

## Python3

 `''' Link list node '''``class` `Node:``    ``def` `__init__(``self``):  ``        ``self``.data ``=` `0``        ``self``.``next` `=` `None``    ` `'''This solution uses the temporary`` ``dummy to build up the result list '''``def` `sortedIntersect(a, b):``    ``dummy ``=` `Node()``    ``tail ``=` `dummy;``    ``dummy.``next` `=` `None``;`` ` `    ``''' Once one or the other``    ``list runs out -- we're done '''``    ``while` `(a !``=` `None` `and` `b !``=` `None``):``        ``if` `(a.data ``=``=` `b.data):``            ``tail.``next` `=` `push((tail.``next``), a.data);``            ``tail ``=` `tail.``next``;``            ``a ``=` `a.``next``;``            ``b ``=` `b.``next``;``        ` `        ``# advance the smaller list``        ``elif``(a.data < b.data):``            ``a ``=` `a.``next``;``        ``else``:``            ``b ``=` `b.``next``;   ``    ``return` `(dummy.``next``);` `''' UTILITY FUNCTIONS '''``''' Function to insert a node at``the beginning of the linked list '''``def` `push(head_ref, new_data):` `    ``''' allocate node '''``    ``new_node ``=` `Node()`` ` `    ``''' put in the data  '''``    ``new_node.data ``=` `new_data;`` ` `    ``''' link the old list off the new node '''``    ``new_node.``next` `=` `(head_ref);`` ` `    ``''' move the head to point to the new node '''``    ``(head_ref) ``=` `new_node;   ``    ``return` `head_ref` `''' Function to print nodes in``   ``a given linked list '''``def` `printList(node):``    ``while` `(node !``=` `None``):``        ``print``(node.data, end``=``' '``)``        ``node ``=` `node.``next``;``     ` `''' Driver code'''``if` `__name__``=``=``'__main__'``:``    ` `    ``''' Start with the empty lists '''``    ``a ``=` `None``;``    ``b ``=` `None``;``    ``intersect ``=` `None``;`` ` `    ``''' Let us create the first sorted``     ``linked list to test the functions``     ``Created linked list will be``     ``1.2.3.4.5.6 '''``    ``a ``=` `push(a, ``6``);``    ``a ``=` `push(a, ``5``);``    ``a ``=` `push(a, ``4``);``    ``a ``=` `push(a, ``3``);``    ``a ``=` `push(a, ``2``);``    ``a ``=` `push(a, ``1``);`` ` `    ``''' Let us create the second sorted linked list``   ``Created linked list will be 2.4.6.8 '''``    ``b ``=` `push(b, ``8``);``    ``b ``=` `push(b, ``6``);``    ``b ``=` `push(b, ``4``);``    ``b ``=` `push(b, ``2``);`` ` `    ``''' Find the intersection two linked lists '''``    ``intersect ``=` `sortedIntersect(a, b);`` ` `    ``print``(``"Linked list containing common items of a & b "``);``    ``printList(intersect);` `# This code is contributed by rutvik_56.`

## C#

 `using` `System;` `public` `class` `GFG``{``  ` `    ``// dummy node for storing intersection``    ``static` `Node dummy = ``null``;``  ` `    ``// tail node for keeping track of``  ``// last node so that it makes easy for insertion``    ``static` `Node tail = ``null``;``    ` `    ``// class - Node``  ``public`  `class` `Node``  ``{``       ``public` `int` `data;``      ``public`  `Node next;` `      ``public`  `Node(``int` `data)``      ``{``            ``this``.data = data;``            ``next = ``null``;``        ``}``    ``}``  ` `     ``// head nodes for pointing to 1st and 2nd linked lists``    ``Node a = ``null``, b = ``null``;``  ` `    ` `    ``// function for printing the list``    ``void` `printList(Node start)``    ``{``        ``Node p = start;``        ``while` `(p != ``null``)``        ``{``            ``Console.Write(p.data + ``" "``);``            ``p = p.next;``        ``}``        ``Console.WriteLine();``    ``}``    ` `    ``// inserting elements into list``    ``void` `push(``int` `data)``    ``{``        ``Node temp = ``new` `Node(data);``        ``if``(dummy == ``null``)``        ``{``            ``dummy = temp;``            ``tail = temp;``        ``}``        ``else``        ``{``            ``tail.next = temp;``            ``tail = temp;``        ``}``    ``}``    ` `    ``// function for finding intersection and adding it to dummy list``    ``void` `sortedIntersect()``    ``{``      ` `        ``// pointers for iterating``        ``Node p = a,q = b;``        ``while``(p != ``null`  `&&  q != ``null``)``        ``{``            ``if``(p.data == q.data)``            ``{``                ``// add to dummy list``                ``push(p.data);``                ``p = p.next;``                ``q = q.next;``            ``}``            ``else` `if``(p.data < q.data)``                ``p = p.next;``            ``else``                ``q= q.next;``        ``}``    ``}``    ` `  ``// Driver code``    ``public` `static` `void` `Main(String []args)``    ``{``        ``GFG list = ``new` `GFG();``        ` `        ``// creating first linked list``        ``list.a = ``new` `Node(1);``        ``list.a.next = ``new` `Node(2);``        ``list.a.next.next = ``new` `Node(3);``        ``list.a.next.next.next = ``new` `Node(4);``        ``list.a.next.next.next.next = ``new` `Node(6);` `        ``// creating second linked list``        ``list.b = ``new` `Node(2);``        ``list.b.next = ``new` `Node(4);``        ``list.b.next.next = ``new` `Node(6);``        ``list.b.next.next.next = ``new` `Node(8);``        ` `        ``// function call for intersection``        ``list.sortedIntersect();``      ` `        ``// print required intersection``        ``Console.WriteLine(``"Linked list containing common items of a & b"``);``        ``list.printList(dummy);``    ``}``}` `// This code is contributed by aashish1995`

## Javascript

 ``

Output:

```Linked list containing common items of a & b
2 4 6```

Complexity Analysis:

• Time Complexity: O(m+n) where m and n are number of nodes in first and second linked lists respectively.
Only one traversal of the lists are needed.
• Auxiliary Space: O(min(m, n)).
The output list can store at most min(m,n) nodes .

Method 2: Using Local References.
Approach: This solution is structurally very similar to the above, but it avoids using a dummy node Instead, it maintains a struct node** pointer, lastPtrRef, that always points to the last pointer of the result list. This solves the same case that the dummy node did — dealing with the result list when it is empty. If the list is built at its tail, either the dummy node or the struct node** “reference” strategy can be used.

Below is the implementation of the above approach:

## C

 `#include ``#include ` `/* Link list node */``struct` `Node {``    ``int` `data;``    ``struct` `Node* next;``};` `void` `push(``struct` `Node** head_ref,``          ``int` `new_data);` `/* This solution uses the local reference */``struct` `Node* sortedIntersect(``    ``struct` `Node* a,``    ``struct` `Node* b)``{``    ``struct` `Node* result = NULL;``    ``struct` `Node** lastPtrRef = &result;` `    ``/* Advance comparing the first``     ``nodes in both lists.``    ``When one or the other list runs``     ``out, we're done. */``    ``while` `(a != NULL && b != NULL) {``        ``if` `(a->data == b->data) {``            ``/* found a node for the intersection */``            ``push(lastPtrRef, a->data);``            ``lastPtrRef = &((*lastPtrRef)->next);``            ``a = a->next;``            ``b = b->next;``        ``}``        ``else` `if` `(a->data < b->data)``            ``a = a->next; ``/* advance the smaller list */``        ``else``            ``b = b->next;``    ``}``    ``return` `(result);``}` `/* UTILITY FUNCTIONS */``/* Function to insert a node at the``   ``beginging of the linked list */``void` `push(``struct` `Node** head_ref,``          ``int` `new_data)``{``    ``/* allocate node */``    ``struct` `Node* new_node = (``struct` `Node*)``malloc``(``        ``sizeof``(``struct` `Node));` `    ``/* put in the data  */``    ``new_node->data = new_data;` `    ``/* link the old list off the new node */``    ``new_node->next = (*head_ref);` `    ``/* move the head to point to the new node */``    ``(*head_ref) = new_node;``}` `/* Function to print nodes in a given linked list */``void` `printList(``struct` `Node* node)``{``    ``while` `(node != NULL) {``        ``printf``(``"%d "``, node->data);``        ``node = node->next;``    ``}``}` `/* Driver program to test above functions*/``int` `main()``{``    ``/* Start with the empty lists */``    ``struct` `Node* a = NULL;``    ``struct` `Node* b = NULL;``    ``struct` `Node* intersect = NULL;` `    ``/* Let us create the first sorted``     ``linked list to test the functions``   ``Created linked list will be``   ``1->2->3->4->5->6 */``    ``push(&a, 6);``    ``push(&a, 5);``    ``push(&a, 4);``    ``push(&a, 3);``    ``push(&a, 2);``    ``push(&a, 1);` `    ``/* Let us create the second sorted linked list``   ``Created linked list will be 2->4->6->8 */``    ``push(&b, 8);``    ``push(&b, 6);``    ``push(&b, 4);``    ``push(&b, 2);` `    ``/* Find the intersection two linked lists */``    ``intersect = sortedIntersect(a, b);` `    ``printf``(``"\n Linked list containing common items of a & b \n "``);``    ``printList(intersect);` `    ``getchar``();``}`

Output:

```Linked list containing common items of a & b
2 4 6```

Complexity Analysis:

• Time Complexity: O(m+n) where m and n are number of nodes in first and second linked lists respectively.
Only one traversal of the lists are needed.
• Auxiliary Space: O(max(m, n)).
The output list can store at most m+n nodes.

Method 3: Recursive Solution.
Approach:
The recursive approach is very similar to the the above two approaches. Build a recursive function that takes two nodes and returns a linked list node. Compare the first element of both the lists.

• If they are similar then call the recursive function with the next node of both the lists. Create a node with the data of the current node and put the returned node from the recursive function to the next pointer of the node created. Return the node created.
• If the values are not equal then remove the smaller node of both the lists and call the recursive function.

Below is the implementation of the above approach:

## C++

 `#include ``using` `namespace` `std;` `// Link list node``struct` `Node``{``    ``int` `data;``    ``struct` `Node* next;``};` `struct` `Node* sortedIntersect(``struct` `Node* a,``                             ``struct` `Node* b)``{``    ` `    ``// base case``    ``if` `(a == NULL || b == NULL)``        ``return` `NULL;` `    ``/* If both lists are non-empty */` `    ``/* Advance the smaller list and``       ``call recursively */``    ``if` `(a->data < b->data)``        ``return` `sortedIntersect(a->next, b);` `    ``if` `(a->data > b->data)``        ``return` `sortedIntersect(a, b->next);` `    ``// Below lines are executed only``    ``// when a->data == b->data``    ``struct` `Node* temp = (``struct` `Node*)``malloc``(``                  ``sizeof``(``struct` `Node));``    ``temp->data = a->data;` `    ``// Advance both lists and call recursively``    ``temp->next = sortedIntersect(a->next,``                                 ``b->next);``    ``return` `temp;``}` `/* UTILITY FUNCTIONS */``/* Function to insert a node at``the beginging of the linked list */``void` `push(``struct` `Node** head_ref, ``int` `new_data)``{``    ` `    ``/* Allocate node */``    ``struct` `Node* new_node = (``struct` `Node*)``malloc``(``                      ``sizeof``(``struct` `Node));` `    ``/* Put in the data  */``    ``new_node->data = new_data;` `    ``/* Link the old list off the new node */``    ``new_node->next = (*head_ref);` `    ``/* Move the head to point to the new node */``    ``(*head_ref) = new_node;``}` `/* Function to print nodes in``   ``a given linked list */``void` `printList(``struct` `Node* node)``{``    ``while` `(node != NULL)``    ``{``        ``cout << ``" "` `<< node->data;``        ``node = node->next;``    ``}``}` `// Driver code``int` `main()``{``    ` `    ``/* Start with the empty lists */``    ``struct` `Node* a = NULL;``    ``struct` `Node* b = NULL;``    ``struct` `Node* intersect = NULL;` `    ``/* Let us create the first sorted``      ``linked list to test the functions``     ``Created linked list will be``      ``1->2->3->4->5->6 */``    ``push(&a, 6);``    ``push(&a, 5);``    ``push(&a, 4);``    ``push(&a, 3);``    ``push(&a, 2);``    ``push(&a, 1);` `    ``/* Let us create the second sorted linked list``     ``Created linked list will be 2->4->6->8 */``    ``push(&b, 8);``    ``push(&b, 6);``    ``push(&b, 4);``    ``push(&b, 2);` `    ``/* Find the intersection two linked lists */``    ``intersect = sortedIntersect(a, b);` `    ``cout << ``"\n Linked list containing "``         ``<< ``"common items of a & b \n "``;``    ``printList(intersect);` `    ``return` `0;``}` `// This code is contributed by shivanisinghss2110`

## C

 `#include ``#include ` `/* Link list node */``struct` `Node {``    ``int` `data;``    ``struct` `Node* next;``};` `struct` `Node* sortedIntersect(``    ``struct` `Node* a,``    ``struct` `Node* b)``{``    ``/* base case */``    ``if` `(a == NULL || b == NULL)``        ``return` `NULL;` `    ``/* If both lists are non-empty */` `    ``/* advance the smaller list and call recursively */``    ``if` `(a->data < b->data)``        ``return` `sortedIntersect(a->next, b);` `    ``if` `(a->data > b->data)``        ``return` `sortedIntersect(a, b->next);` `    ``// Below lines are executed only``    ``// when a->data == b->data``    ``struct` `Node* temp``        ``= (``struct` `Node*)``malloc``(``            ``sizeof``(``struct` `Node));``    ``temp->data = a->data;` `    ``/* advance both lists and call recursively */``    ``temp->next = sortedIntersect(a->next, b->next);``    ``return` `temp;``}` `/* UTILITY FUNCTIONS */``/* Function to insert a node at``the beginging of the linked list */``void` `push(``struct` `Node** head_ref, ``int` `new_data)``{``    ``/* allocate node */``    ``struct` `Node* new_node``        ``= (``struct` `Node*)``malloc``(``            ``sizeof``(``struct` `Node));` `    ``/* put in the data  */``    ``new_node->data = new_data;` `    ``/* link the old list off the new node */``    ``new_node->next = (*head_ref);` `    ``/* move the head to point to the new node */``    ``(*head_ref) = new_node;``}` `/* Function to print nodes in a given linked list */``void` `printList(``struct` `Node* node)``{``    ``while` `(node != NULL) {``        ``printf``(``"%d "``, node->data);``        ``node = node->next;``    ``}``}` `/* Driver program to test above functions*/``int` `main()``{``    ``/* Start with the empty lists */``    ``struct` `Node* a = NULL;``    ``struct` `Node* b = NULL;``    ``struct` `Node* intersect = NULL;` `    ``/* Let us create the first sorted``      ``linked list to test the functions``     ``Created linked list will be``      ``1->2->3->4->5->6 */``    ``push(&a, 6);``    ``push(&a, 5);``    ``push(&a, 4);``    ``push(&a, 3);``    ``push(&a, 2);``    ``push(&a, 1);` `    ``/* Let us create the second sorted linked list``     ``Created linked list will be 2->4->6->8 */``    ``push(&b, 8);``    ``push(&b, 6);``    ``push(&b, 4);``    ``push(&b, 2);` `    ``/* Find the intersection two linked lists */``    ``intersect = sortedIntersect(a, b);` `    ``printf``(``"\n Linked list containing common items of a & b \n "``);``    ``printList(intersect);` `    ``return` `0;``}`

Output:

```Linked list containing common items of a & b
2 4 6```

Complexity Analysis:

• Time Complexity: O(m+n) where m and n are number of nodes in first and second linked lists respectively.
Only one traversal of the lists are needed.
• Auxiliary Space: O(max(m, n)).
The output list can store at most m+n nodes.

Please write comments if you find the above codes/algorithms incorrect, or find better ways to solve the same problem.
References: