Given the head of a singly linked list and an integer val, remove all nodes whose value equals val and return the new head.
Use a dummy node to handle head deletions cleanly.
Input: Head of a singly linked list and integer val.
Output: Head of the updated linked list with all matching nodes removed.
Input: [1,2,6,3,4,5,6], 6
Output: [1,2,3,4,5]
Explanation: Remove both 6s. Result: 1→2→3→4→5.Input: [7,7,7,7], 7
Output: []
Explanation: All nodes removed. Return NULL.Input: [1,2,3], 4
Output: [1,2,3]
Explanation: Val 4 not found. Return list unchanged.0<=nodes<=10^41<=Node.val<=500<=val<=50