More Linked List Hacker Rank Solution

def removeDuplicates(self,head):
temp = head
while temp is not None and temp.next is not None:
while(temp.next is not None and temp.data == temp.next.data):
temp.next = temp.next.next
temp = temp.next
return head

Comments

Popular Posts