posted 11 years ago
I'm stuck on a problem. Can anyone please give a hint of how to solve it or please solve this problem. I want to take an input(N) from user and produce the output as follows:
And 0 < N < 101
• For N = 1:
"a", "b", ..., "z".
• For N = 2:
"a", "b", ..., "z",
"aa", "ab", ..., "az",
"ba", "bb", ..., "bz",
.
.
.
"za", "zb", ...,"zz"
• For N = 3:
"a", "b", ..., "z",
"aa", "ab", ..., "az",
"ba", "bb", ..., "bz",
.
.
.
"za", "zb", ...,"zz"
"aaa", "aab", ..., "aaz",
"aba", "abb", ..., "abz"
.
.
.
"baa", "bab", ..., "baz", ...,
.
.
"zaz", "zbz", ..., "zzz".
Since the answer can be quite large I should output it as modulo 1000000007 (10E9 + 7).
How will I loop through these conditions?
OCPJP 6 - 96%
Currently working on Scala at Knoldus Software