Skip to content

Commit a3138a8

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent abe29f6 commit a3138a8

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

data_structures/linked_list/reverse_linked_list.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
https://www.enjoyalgorithms.com/blog/reverse-linked-list
33
"""
44

5+
56
class ListNode:
67
"""Definition for singly-linked list."""
8+
79
def __init__(self, val=0, next=None):
810
self.val = val
911
self.next = next
@@ -40,6 +42,7 @@ def reverse_linked_list(head: ListNode) -> ListNode:
4042

4143
if __name__ == "__main__":
4244
import doctest
45+
4346
doctest.testmod()
4447

4548
# Example execution
@@ -50,4 +53,6 @@ def reverse_linked_list(head: ListNode) -> ListNode:
5053

5154
print("Original Linked List: 1 -> 2 -> 3")
5255
new_head = reverse_linked_list(a)
53-
print(f"Reversed Linked List: {new_head.val} -> {new_head.next.val} -> {new_head.next.next.val}")
56+
print(
57+
f"Reversed Linked List: {new_head.val} -> {new_head.next.val} -> {new_head.next.next.val}"
58+
)

0 commit comments

Comments
 (0)