20
4
The task is to generate all the strings from 'a' to '999' including upper case characters like so:
'a', 'b', 'c' ... 'y', 'z', 'A', 'B', 'C' ... 'Y', 'Z', '0', '1', 2' ...
'8', '9', 'aa', 'ab', 'ac' ... 'az', 'aA', 'aB' ... 'aZ', 'a0' ... 'a9', 'ba'
and so on (filling in the gaps), optionally starting with the empty string.
Input:
- The amount of consecutive characters the program has to print up to.
Output:
- An array containing each string OR one string per line
Clarifications:
The order doesn't matter, you can print uppercase or lowercase letters first if you want.
The output can return any type of enumerable, doesn't have to be an array specifically, although I doubt printing all the combinations won't be the easiest way to go.
An input of
3
would print all the string from'a'
(or''
) to'999'
‚ an input of5
up to'99999'
and so on.
What do you mean by outputting an array? – frederick – 2016-05-03T22:41:26.050
So letters and numbers only? What order do you use? In ASCII numbers come first, then uppercase letters, the lowercase – Luis Mendo – 2016-05-03T22:43:18.443
An enumerable containing all the values i.e. ['a', 'b', 'c' ..]. You should either see the output on each line via STDOUT or be able to assign it via
a = (function return)
. – Simon Landry – 2016-05-03T22:45:10.550@LuisMendo The order doesn't matter, as long as all the number/letter combinaisons are there. – Simon Landry – 2016-05-03T22:46:24.167
1@edc65 As I understand it, the input is the maximum number of characters to combine. So for input 4, you go from
a
to9999
, for 5 it'sa
to99999
, and so on. – Alex A. – 2016-05-03T23:02:50.370@edc65 An input of
3
would print all the string from'a'
to'999'
‚ an input of5
up to'99999'
and so on. – Simon Landry – 2016-05-03T23:03:25.453Is a leading newline for the output okay :p? – Adnan – 2016-05-03T23:22:45.273
So, you're basically listing base 62 numbers up to N digits, where N is the input? – Wildcard – 2016-05-04T01:19:09.857
@Wildcard Exactly. – Simon Landry – 2016-05-04T02:01:41.003
@Adnan Sure as long as the rest of the input is fine, I'll allow a newline. :) – Simon Landry – 2016-05-04T02:04:35.830
Since a leading newline is allowed, would be returning an array that starts with an empty string be acceptable as well? – Dennis – 2016-05-04T03:14:35.963
@Dennis I guess that's only fair :) – Simon Landry – 2016-05-04T03:23:06.613
3OK, thanks for clearing that up. That saved a lot of bytes. :) I think the current title is a bit confusing since you seem to require bijective base 62. – Dennis – 2016-05-04T03:44:06.783
It's not really base 62 (you would not have 00, 000 and so on). It's more like Excel column naming. We had a challenge about that: http://codegolf.stackexchange.com/q/37515/21348
– edc65 – 2016-05-04T08:17:20.977@Dennis, the question still looks to me like it requires bijective base 62 (and if I didn't have a supervote, I'd vote to close as a dupe of http://codegolf.stackexchange.com/q/54105/194 )
– Peter Taylor – 2016-05-04T08:35:50.073@PeterTaylor it's close but simpler. Not all challenges about bijective base are dupes – edc65 – 2016-05-04T08:49:06.787
What is the largest expected input? – Digital Trauma – 2016-05-05T22:46:19.857
@DigitalTrauma Most people have been using 2 and 3 as their test case, if it works with both your answer will be considered good. – Simon Landry – 2016-05-06T01:14:33.397