I am asked to reverse a which takes head as parameter where as head is a linked list e.g.: 1 -> 2 -> 3 which was returned from a function already defined I tried to implemen
def reverseLinkedList(head): current = head previous = None nextNode = None while current: nextNode = current.nextNode current.nextNode = previous previous = current current = nextNode return previous