func removeElements(head *ListNode, val int) *ListNode {
var (
prev *ListNode = nil
curr *ListNode = head
)
for curr != nil {
if curr.Val == val {
// Head node
if prev == nil {
head = head.Next
curr = head
} else {
prev.Next = curr.Next
curr = curr.Next
}
continue
}
prev = curr
curr = curr.Next
}
return head
}