Description
Given a length n
, and an alphabet size k>0
, your program must determine the number of strings with those parameters which have a maximal number of unique substrings. In the case of k=2
, this generates OEIS A134457.
Example
For example, 2210
has the substrings
, 2
, 22
, 221
, 2210
, 2
, 21
, 210
, 1
, 10
, and 0
, for a total of 11. However, 2
appears twice, so it only has 10 unique substrings.
This is as many as possible for a length 4 string containing 3 different symbols, but it ties with 35 other strings for a total of 36 tieing strings including 0012
, 2101
, and 0121
. Therefore, for n=4
and k=3
, your program should output 36.
Test Cases
n k output
0 5 1
1 3 3
5 1 1
9 2 40
2 3 6
5 5 120
n=2
,k=3
output 9:11,12,21,22,31,32,33,13,23
? \$\endgroup\$