Delete N Nodes After M Nodes in a Linked List
Difficulty Level: Rookie
In this problem, you are given a linked list and two integers, M and N. You need to traverse the linked list such that you:
-
Retain M nodes, then
-
Delete the next N nodes, and
-
Repeat this process until the end of the linked list.
Problem Statement
-
Input: A linked list and two integers M and N
-
Output: The modified linked list after deleting N nodes after every M nodes