Given the head of a linked list and an integer val, remove all the nodes of the linked list that have Node.val == val, and return the new head.
Note: For this problem, linked lists are represented as arrays for simplicity. The function takes the list as an array and should return the resulting list as an array.