From 4a034880223f69b2a658eca2888fc026c0edae0f Mon Sep 17 00:00:00 2001 From: marina <138340846+bt3gl-cryptographer@users.noreply.github.com> Date: Mon, 7 Aug 2023 15:51:56 -0700 Subject: [PATCH] Update add_two_numbers.py --- linked_lists/add_two_numbers.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/linked_lists/add_two_numbers.py b/linked_lists/add_two_numbers.py index 850bf21..ae53ca7 100644 --- a/linked_lists/add_two_numbers.py +++ b/linked_lists/add_two_numbers.py @@ -9,6 +9,7 @@ class Node: self.val = val self.next = None + def add_two_numbers(l1, l2): n1, n2, i = '', '', 1 @@ -25,11 +26,11 @@ def add_two_numbers(l1, l2): n2 = int(n2[::-1]) n = str(n1 + n2)[::-1] - current = ListNode(n[0]) + current = Node(n[0]) head = current while i < len(n): - current.next = ListNode(n[i]) + current.next = Node(n[i]) current = current.next i += 1