Remove Duplicate Values From a Linked List

Asked at Salesforce · Coding Questions · Difficulty: Easy · Last asked Jan 30, 2026

Given the head of a singly linked list of integers, remove every node whose value already appeared earlier in the list, so that each distinct value is kept exactly once, at its first position. Return the head of the resulting list.

Loading the problem…