From c004a953a9c19fb3716d13b30e2cafcd1df350ac Mon Sep 17 00:00:00 2001 From: marina <138340846+bt3gl-cryptographer@users.noreply.github.com> Date: Wed, 2 Aug 2023 17:49:22 -0700 Subject: [PATCH] Update reverse_linked_list.py --- linked_lists/reverse_linked_list.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/linked_lists/reverse_linked_list.py b/linked_lists/reverse_linked_list.py index fde6bdc..6e0a013 100644 --- a/linked_lists/reverse_linked_list.py +++ b/linked_lists/reverse_linked_list.py @@ -2,15 +2,15 @@ # -*- coding: utf-8 -*- # author: bt3gl -class ListNode: - def __init__(self, val=0, next=None): +class Node: + def __init__(self, val=0, next): self.val = val self.next = next -def reverse_list(head: Optional[ListNode]) -> Optional[ListNode]: +def reverse_list(head: Optional[Node]) -> Optional[Node]: - if (not head) or (not head.next): + if not head or not head.next: return head new_head = reverse_list(head.next)