Remove All Nodes With a Given Value From a Linked List

Asked at Warner Music Group · Coding Questions · Difficulty: Easy

Given the head of a singly linked list and an integer `val`, delete every node whose value equals `val` and return the head of the resulting list. The relative order of the remaining nodes must not change, and the list is edited in place.

Loading the problem…