Dsa
Linked List
Easy
Remove Elements From Linked List
Write a function to remove all elements from a linked list of integers that have a specific value.
### Input Format:
- The first line contains an integer n, the number of nodes in the linked list.
- The next n lines contain integers representing the values of nodes.
- The last line contains the integer val, the value to be removed.
### Output Format:
- Print the values of the modified linked list in order, separated by spaces.
### Example:
Input:
5
1
2
6
3
4
6
Output:
1 2 3 4
Key concepts
linked_listremovalfiltering
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now