1474. Delete N Nodes After M Nodes of a Linked List
You are given the
head
of a linked list and two integersm
andn
.Traverse the linked list and remove some nodes in the following way:
- Start with the head as the current node.
- Keep the first
m
nodes starting with the current node.- Remove the next
n
nodes- 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 | /** |