1474. Delete N Nodes After M Nodes of a Linked List
You are given the
headof a linked list and two integersmandn.Traverse the linked list and remove some nodes in the following way:
- Start with the head as the current node.
- Keep the first
mnodes starting with the current node.- Remove the next
nnodes- Keep repeating steps 2 and 3 until you reach the end of the list.
Return the head of the modified list after removing the mentioned nodes.
1 | /** |