In-place Reversal Linked List
def reverse(start: Node) -> Node:
curr = start
previous = None
while curr:
next = curr.next
curr.next = previous
previous = curr
curr = next
return previous
class Node:
__slots__ = ['next', 'value']
def __init__(self, value: int):
self.value = value
self.next = None