Delete All Occurrences of a Given Key in a Linked List
We’re given the head of a linked list and a key. Delete all the nodes that contain the given key.
Note: The input linked list will not have cycles in it.
The following example elaborates this problem further: