You are viewing a single comment's thread. Return to all comments →
C++ solution
vector<int> permutationEquation(vector<int> p) { vector<int> o(p.size()); int j,k=0; for (int i = 1; i <= p.size(); ++i) { while (p[j] != i && j < p.size()) {++j;}; while (p[k] != j+1 && k < p.size()) {++k;}; o.at(i-1) = k+1; j = 0; k = 0; } return o; }
Seems like cookies are disabled on this browser, please enable them to open this website
Sequence Equation
You are viewing a single comment's thread. Return to all comments →
C++ solution