Remove every occurrence
Write remove_all(head, target) that removes every node whose val
equals target from the linked list and returns the head of what
remains, which may be None.
remove_all(1 -> 2 -> 1 -> 3 -> 1, 1) -> 2 -> 3
remove_all(7 -> 7, 7) -> None
remove_all(None, 7) -> None
The point is to practise the dummy-head technique, so the head being removed needs no special case.
def remove_all(head, target):
...