Remove all occurrences of a target value from a linked list

Asked at Arista Networks · Coding Questions · Difficulty: Easy · Last asked Jul 15, 2026

Given the head of a singly linked list `head` and an integer `target`, remove **all** nodes whose value equals `target`, and return the new head.

Loading the problem…