Tap here to switch tabs
Problem
Submissions

Problem: Remove Duplicates From an Unsorted Linked List

Remove Duplicates From an Unsorted Linked List gives you a linked list and asks you to delete every node whose value appears more than once, preserving the order of unique nodes.

Statement

Given the head of a linked list, delete all nodes that have duplicate values from the list.

Return the modified linked list after removing all occurrences of any duplicate values. The relative order of the remaining unique nodes must be preserved.

Constraints:

  • The number of nodes in the list is in the range [1,105][1, 10^5].

  • 1≤1 \leq Node.val ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Remove Duplicates From an Unsorted Linked List

Remove Duplicates From an Unsorted Linked List gives you a linked list and asks you to delete every node whose value appears more than once, preserving the order of unique nodes.

Statement

Given the head of a linked list, delete all nodes that have duplicate values from the list.

Return the modified linked list after removing all occurrences of any duplicate values. The relative order of the remaining unique nodes must be preserved.

Constraints:

  • The number of nodes in the list is in the range [1,105][1, 10^5].

  • 1≤1 \leq Node.val ≤105\leq 10^5