Josephus Permutation Time : Space : 1234567891011121314#include <queue>using namespace std;std::vector < int> josephus(std::vector < int > items, int k) { vector<int> res; queue<int> q; for(auto i : items) q.push(i); while(q.size()) { for(int i = 0; i < (k - 1) % q.size(); i++) { q.push(q.front()); q.pop(); } res.push_back(q.front()); q.pop(); } return res;}