so I know that there are a lot of ways to compute unique permutations. Usually it is slower to apply restrictions during the generation than removing them afterwards. So let's say I have a vector of 10 elements. For the sake of an example:
std::vector<int> v = {7, 5, 16, 8, 5, 8, 1, 7, 3, 25, 109, 8};
I have the unique restriction that I know that I am not allowed to have the same three numbers in a row, so all permutations containing {8,8,8} in any place would be invalid. In case I have a giant array of e.g. 20 elements I would assume that I could save a lot of time if I skip all permutations that start with {8,8,8}.
Is there any to do anything like this efficiently? How do I figure out at which point it makes sense to add the additional slowdown of checking each permutation?