Given the head of a singly linked list and a target value, delete the first node whose value equals target and return the head of the resulting list. If the target is not found, return the list unchanged. If the list is empty, return an empty list.
Input
head: head of a singly linked list
target: integer value to delete
Output
The head of the modified linked list (or empty list if it becomes empty).
Examples
Example 1
Inputhead = [1, 2, 3], target = 1
Output[2, 3]
Example 2
Inputhead = [1, 2, 1, 2], target = 2
Output[1, 1, 2]
Explanation: Only the first occurrence of 2 is removed.
Constraints
Delete at most one node (the first match).
Return the original list if target is absent.