Permutations Time : O(n!) Space : O(n!) 123456789101112#include <vector>using namespace std;vector<vector<int>> getPermutations(vector<int> array) { if(array.empty()) return {}; vector<vector<int>> res; do { res.push_back(array); }while(next_permutation(begin(array), end(array))); return res;}