Dsa
Linked List
Easy
Remove Elements from Linked List
Given a linked list and a target value, remove all nodes that have that target value. The list should be modified in-place, and return the modified list as integers.
Input format:
- The first line contains integers n (the number of nodes), followed by n integers representing the values of the nodes, followed by an integer target.
Output format:
- Output the modified linked list as integers in order from head to tail.
Example:
Input:
5 1 2 3 4 5 3
Output:
1 2 4 5
Key concepts
linked_listdeletioniterator
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