Super Permutations
#Super Permutations FindFind the super permutation for a set of size n. A super permutation of a set is one string that contains all permutations of that set. Here is a helpful video by Matt Parker #Example For
Example
For a set of size 2 all the permutations are AB, BA
but the super permutation is ABA
because it contains the string AB
and BA
.
For a set of 3 all permutations are ABC,ACB,BAC,BCA,CBA,CAB
and the super permutation is ABCABACBA
.
#Challenge
Given
Challenge
Given a certain size n (n>=1) find a super permutation of that set. To do this you have to use a pattern explained in the video. #Input An
Input
An integer greater than 0. This can be a function input superperm(n)
or be taken from user input.
#Output
super
Output
super permutation of that sized set. This can either be printed out or the return value of a function #Sample Inputs all
Sample Inputs
all of these are the shortest for that length but this is not a requirement.
1: A
2: ABA
3: ABCABACBA
4: ABCDABCADBCABDCABADABACDBACBDACBADCBA