You are viewing a single comment's thread. Return to all comments →
Small point - but this will produce an AttributeError in the case of an empty list. Fix:
def RemoveDuplicates(head): if head is None: return head node = head while node.next: if node.data == node.next.data: node.next = node.next.next else: node = node.next return head
Seems like cookies are disabled on this browser, please enable them to open this website
Delete duplicate-value nodes from a sorted linked list
You are viewing a single comment's thread. Return to all comments →
Small point - but this will produce an AttributeError in the case of an empty list. Fix: