I am looking to do it with Python. And I don\'t want to just print it in reverse, but actually reverse the given nodes. I have seen it done in other languages but had trouble fi
Very similar to poke's solution, but I prefer to have the base case first:
def reverse(head, reversed=None): if head is None: return reversed new_head = head.next head.next = reversed new_reversed = head return reverse(new_head, new_reversed)