-->
当前位置:首页 > 题库

PROGRAMMING:Finding the penultimate k-th term of chain linear table

Luz5年前 (2021-05-10)题库513
Given a series of positive integers, please design an algorithm as efficient as possible to find the number in the penultimate K position.
###Input format:
Input first gives a positive integer k, followed by a number of non negative integers, and finally ends with a negative integer (the negative number is not included in the sequence, do not process).
###Output format:
Output the data at the last K position. If the location does not exist, the error message 'null' is output.
###Input example:
```in
4 1 2 3 4 5 6 7 8 9 0 -1
```
###Output example:
```out
seven
```






answer:If there is no answer, please comment