Given the head of a linked list and an integer val, remove all nodes whose value equals val and return the new head. The list is given as an array; return the resulting array. Input: '[list], val'.
Input: '[list], val'.
Output: Array — the list after removals.
Input: [1,2,6,3,4,5,6], 6
Output: [1,2,3,4,5]
Explanation: Both 6s removed.Input: [7,7,7,7], 7
Output: []
Explanation: All removed.Input: [1,2,3], 4
Output: [1,2,3]
Explanation: No match.0<=n<=10^40<=value,val<=50