Delete a Value From a List

L6 Medium Linked List
Concept
Removing a node is all about repointing the previous node's next past the victim. A dummy head keeps the removal uniform, including for the first node.
Given the head of a singly linked list and an integer val that appears in the list, remove every node whose value equals val and return the head.
Examples
▸ head = [4, 5, 1, 9], val = 5
→ [4, 1, 9]
▸ head = [4, 5, 1, 9], val = 4
→ [5, 1, 9]
▸ head = [2], val = 2
→ []
Progressive Hints
Hint 1 · Nudge
A dummy head turns 'delete the head' into the exact same case as any other delete.
Hint 2 · Plan
Walk the list with a pointer whose next is the current candidate. While that next node holds val, skip over it. Otherwise move the pointer on. Return the true head after the dummy.
Hint 3 · Approach
dummy = node pointing at head; cur = dummy. While cur.next exists: if cur.next.val == val then cur.next = cur.next.next else cur = cur.next. Return dummy.next.
Output
// Run your code to see the output here.