Tap here to switch tabs
Problem
Submissions

Problem: Remove Duplicates from Sorted List II

Remove Duplicates from Sorted List II keeps only values that appear once in an ascending linked list, removing every node belonging to a repeated value, and returns the updated head.

Statement

Given the head node head of a singly linked list sorted in ascending order, remove every value that appears more than once so that only values that occur exactly once remain in the list. Return the head of the modified linked list.

Note: Nodes with duplicate values are removed entirely, not reduced to a single occurrence.

Constraints:

  • The number of nodes in the list is in the range [0,300][0, 300].

  • −100≤-100 \leq Node.val ≤100\leq 100.

  • The linked list is guaranteed to be sorted in ascending order.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Remove Duplicates from Sorted List II

Remove Duplicates from Sorted List II keeps only values that appear once in an ascending linked list, removing every node belonging to a repeated value, and returns the updated head.

Statement

Given the head node head of a singly linked list sorted in ascending order, remove every value that appears more than once so that only values that occur exactly once remain in the list. Return the head of the modified linked list.

Note: Nodes with duplicate values are removed entirely, not reduced to a single occurrence.

Constraints:

  • The number of nodes in the list is in the range [0,300][0, 300].

  • −100≤-100 \leq Node.val ≤100\leq 100.

  • The linked list is guaranteed to be sorted in ascending order.