You are viewing a single comment's thread. Return to all comments →
Non-recursive, constant memory usage. Python2 implementation
def RemoveDuplicates(head): start = head while start.next is not None: nxt = start.next if start.data == nxt.data: start.next = nxt.next nxt.next = None else: start = start.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 →
Non-recursive, constant memory usage. Python2 implementation