Given a linked list and a key, remove all occurrences of the key from the Linked List. Return the head of the resultant list.
Linked List: 1→2→3→2→4→7→2
Key: 2
After removal: 1→3→4→7
The first line contains ‘T’ denoting the number of independent test cases.
For each test case the input has three lines:
For each test case, the output has one line with space-separated integers denoting the elements of the resultant linked list.
2
7
1 2 3 2 4 7 2
2
3
4 5 6
8
1 3 4 7
4 5 6
1 <= T <= 100
0 <= n <= 104
1 <= element <= 1000
1 <= key <= 1000