Skip to content
C

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.

Input (stdin)

Output

Run your code to see output here...