I need to find a function that works like this:
int[] matches = getAllPossibleCombinations(
int lengthOfEachIntReturnedInArray,
List<char> typesOfElementsUsedInCombinations);
input elements would be these (this is just an example):
int lengthofeachintreturnedinarray = (int) 2
List<char> typesofelementsusedincombinations = {a,b}
then the output would have to be (in a string array):
aa
ab
ba
bb
Each individual output element in the array must have a length defined by the first argument in the method (in this case 2) and must contain all possible combinations between the given letters in the second argument
I have seen something about powersets, should I use them, or should foreach
loops suit the job?
! the proposed question with answer above is NOT the same, it doesn't use set lenghts !
List<string>
or aList<char>
? i.e., can the individual elements be more than one character each ? - Charles Bretana