You are viewing a single comment's thread. Return to all comments →
Another recursive Python solution:
def reverse_helper(node): if node.next is not None: reverse_helper(node.next) node.next.next = node node.next = None def reverse(head): last_node = head while last_node.next is not None: last_node = last_node.next reverse_helper(head) return last_node
Seems like cookies are disabled on this browser, please enable them to open this website
Reverse a linked list
You are viewing a single comment's thread. Return to all comments →
Another recursive Python solution: