Solution Review: Remove Duplicates
This lesson contains the solution review for the challenge of removing duplicates from a doubly linked list.
We'll cover the following...
In this lesson, we consider how to remove duplicates from a doubly linked list.
Implementation
Check out the code below:
def remove_duplicates(self):cur = self.headseen = dict()while cur:if cur.data not in seen:seen[cur.data] = 1cur = cur.nextelse:nxt = cur.nextself.delete_node(cur)cur = nxt
...