You are viewing a single comment's thread. Return to all comments →
ah! I forgot this question had sorted nodes. Here is my general Python solution
def RemoveDuplicates(head): setStack = set() probe = head while probe.next: setStack.add(probe.data) if probe.next.data in setStack: probe.next = probe.next.next else: probe = probe.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 →
ah! I forgot this question had sorted nodes. Here is my general Python solution