In java, I'm trying to find a way to generate permutations based on restrictions. How can I generate the number of permutations (with the restrictions in mind), or at least know how many?
Edit: Simple Restriction Definition:
Possible values: A, B, C
Restrictions: a[0] == a[1]
and a[0] != [2]
Example dataset:
AABA
AABB
AABC
AACA
AACB
AACC
BBAA
BBAB
BBAC
BBCA
BBCB
BBCC
CCAA
CCAB
CCAC
CCBA
CCBB
CCBC
I've tried generating all permutations and then subtracting the incompatible ones, this seems terribly inefficient. How can I do this efficiently? I only need to count the permutations, however it would be good to generate them all.