Smallest solution in python

interview-questions
Tags: #<Tag:0x00007f182851ee50>

#1
def reverseList(self, A):
    if(A.next==None):
        return A
    q=self.reverseList(A.next)
    A.next.next=A
    A.next=None
    return q