Remove Nth Node from End of List

Try to solve the Remove Nth Node from End of List problem.

Statement

Given the head of a singly linked list and an integer n, remove the nth node from the end of the list and return the head of the modified list.

Constraints:

  • The number of nodes in the list is kk.

  • 11 \leq kk 103\leq 10^3

  • 103−10^3 \leq Node.value 103\leq 10^3

  • 11 \leq n k\leq k

Examples

Create a free account to view this lesson.

Continue your learning journey with a 14-day free trial.

By signing up, you agree to Educative's Terms of Service and Privacy Policy