CodeOath
← All problems

Remove Nth Node From End of List

Medium
linked-listtwo-pointers

Given the head of a linked list, remove the n-th node from the end of the list, and return its head.

Lists in this problem are given and returned as a plain array of values, in order.

Example:

Input: head = [1,2,3,4,5], n = 2
Output: [1,2,3,5]