1474. Delete N Nodes After M Nodes of a Linked List

Problem

Given a linked list, delete N nodes after every M nodes and return the modified list.

Given the head of a linked list and two integers m and n, delete n nodes after every m nodes in the list. This pattern continues until the end of the list.

The deletion is done in-place, meaning you modify the original list.

Examples
Input: [[1,2,3,4,5,6,7,8,9,10,11,12,13],2,3]
Output: [1,2,6,7,11,12]
Hints
Related Problems

1474. Delete N Nodes After M Nodes of a Linked List

Given a linked list, delete N nodes after every M nodes and return the modified list.