# 160. Intersection of Two Linked Lists
## Description
Given the heads of two singly linked-lists headA and headB, return the node at which the two lists intersect. If the two linked lists have no intersection at all, return null.
## Solution
- Step1
Create a set() called same to check that if same node has been seen
- Step2
Traverse two linked-list and check the set to see weather it has already been visited
```python=
class Solution:
def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> Optional[ListNode]:
same = set()
cur1 = headA
cur2 = headB
while cur1:
same.add(cur1)
cur1 = cur1.next
while cur2:
if cur2 in same:
return cur2
else:
same.add(cur2)
cur2 = cur2.next
return
```
## Complxity
Time complexity : O(N)