Skip to content

Latest commit

 

History

History
29 lines (25 loc) · 763 Bytes

File metadata and controls

29 lines (25 loc) · 763 Bytes

Mth to last element

Challenge Description:

Write a program which determines the Mth to the last element in a list.

Input sample:

The first argument is a path to a file. The file contains the series of space delimited characters followed by an integer. The integer represents an index in the list (1-based), one per line.

For example:

a b c d 4
e f g h 2

Output sample:

Print to stdout the Mth element from the end of the list, one per line. If the index is larger than the number of elements in the list, ignore that input.

For example:

a
g