banned of distinct forbidden numbers and the head head of a singly linked list. Remove every node whose value appears in banned and return the head of the resulting list.
The remaining nodes must keep their original order. At least one node is guaranteed to survive.banned=[4, 9], head=list_node([9, 2, 4, 4, 7]) → [2, 7]
All nodes holding 9 or 4 are removed; the rest keep their order: 2, 7.
banned=[6], head=list_node([1, 3, 5]) → [1, 3, 5]
There are no 6s in the list, so it stays the same.
banned=[1, 2], head=list_node([2, 8, 1, 8]) → [8, 8]
bannedbanned=[4, 9], head=list_node([9, 2, 4, 4, 7])
[2, 7]
Run checks the first 3 tests in your browser. Submit checks all 81 tests on the server, hidden ones included.