Easy Lists

Remove Duplicates (Doubly Linked List)

Receives an array of integers and builds a doubly linked list, where each node holds a value, a next pointer to the following node, and a prev pointer to the preceding one. It walks the list forward from head to tail using a set to track seen values; the first occurrence of each value is kept and any duplicate node is unlinked by updating both its predecessor's next and its successor's prev. Returns the head of the filtered list with each value appearing exactly once, preserving the original order.

Visualization

Input

Algorithm code

Custom input

Saved inputs

References