📅  最后修改于: 2022-03-11 14:59:13.697000             🧑  作者: Mango
void find_permutations(vector &array, size_t index, vector current_perm, vector> &res){
if(index == array.size())
res.push_back(current_perm);
else{
for(size_t i = 0; i <= current_perm.size(); ++i){
vector new_perm(current_perm.begin(), current_perm.end());
new_perm.insert(new_perm.begin()+i, array[index]);
find_permutations(array, index+1, new_perm, res);
}
}
}