From f4e0ae070a7094e1e0d3d04ec65a6b21cace8d5d Mon Sep 17 00:00:00 2001 From: Jamie H Date: Thu, 15 Dec 2022 16:05:27 -0500 Subject: [PATCH] quick solution --- linked_lists/intersection.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/linked_lists/intersection.py b/linked_lists/intersection.py index f07e2ae..8756c20 100644 --- a/linked_lists/intersection.py +++ b/linked_lists/intersection.py @@ -11,4 +11,13 @@ 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 + nodeA = headA + nodeB = headB + while nodeB: + while nodeA: + if nodeB == nodeA: + return nodeB + nodeA = nodeA.next + nodeA = headA + nodeB = nodeB.next + return None \ No newline at end of file