Length of linked list
ptr=ListNode(0) ptr.next=head length=0 while ptr.next: ptr=ptr.next length+=1 return length