Skip to content
CampusEduX

Find Nth Node from End

Easyjavapythonccppjavascript

Given a linked list and an integer K, find the K-th node from the end of the list (1-indexed).

Input Format

The first line contains two integers N and K. The second line contains N space-separated integers.

Output Format

Print the value of the K-th node from the end.

Related Problems

  • Create and Traverse a Linked List
    Easy · java, python, c, cpp, javascript
    Solve Problem
  • Insert at Beginning of Linked List
    Easy · java, python, c, cpp, javascript
    Solve Problem
  • Insert at End of Linked List
    Easy · java, python, c, cpp, javascript
    Solve Problem

Input (stdin)

Output

Run your code to see output here...