From b00d2ff290e396517dc1694e2b3bfa8c775ae213 Mon Sep 17 00:00:00 2001 From: Ada Date: Sat, 14 Jan 2023 22:35:33 -0800 Subject: [PATCH] resolved. --- linked_lists/intersection.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/linked_lists/intersection.py b/linked_lists/intersection.py index f07e2ae..ca9a42e 100644 --- a/linked_lists/intersection.py +++ b/linked_lists/intersection.py @@ -11,4 +11,17 @@ def intersection_node(headA, headB): """ Will return the node at which the two lists intersect. If the two linked lists have no intersection at all, return None. """ - pass \ No newline at end of file + current_A = headA + current_B = headB + + while current_A: + while current_B: + if current_A == current_B: + return current_A + else: + current_B = current_B.next + current_A = current_A.next + current_B = headB + + + return None \ No newline at end of file