Search⌘ K
AI Features

Solution: Remove Linked List Elements

Solution: Remove Linked List Elements gives you a linked list and a target value. Remove every node matching that value and return the updated list, including when the head changes.

Statement

You are given the head of a linked list and an integer k. Remove all nodes from the linked list where the node’s value equals k, and return the head of the updated list.

Constraints:

  • The number of nodes in the list is in the range ...