adamcrussell

Perl Weekly Challenge 060

Part 1

Write a script that accepts a number and returns the Excel Column Name it represents and vice-versa.

Excel columns start at A and increase lexicographically using the 26 letters of the English alphabet, A..Z. After Z, the columns pick up an extra “digit”, going from AA, AB, etc., which could (in theory) continue to an arbitrary number of digits.

ch-1.pl
ch-1.pl

Sample Run

$ perl perl/ch-1.pl
AB
AAAB
AD
1
26
28
104

Part 2

Write a script that accepts list of positive numbers (@L) and two positive numbers $X and $Y.

The script should print all possible numbers made by concatenating the numbers from @L, whose length is exactly $X but value is less than $Y.

ch-2.pl
ch-2.pl

Sample Run

$ perl perl/ch-2.pl
10 11 12 15 20

Comments for this post were locked by the author