题解 | #输出单向链表中倒数第k个结点#
输出单向链表中倒数第k个结点
http://www.nowcoder.com/practice/54404a78aec1435a81150f15f899417d
import java.util.*;
public class Main{
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()){
int n = sc.nextInt();
List list = new ArrayList();
for (int i = 0; i < n; i++) {
list.add(i,sc.nextInt());
}
int k = sc.nextInt();
System.out.println(list.get(n - k));
}
}
}