You are viewing a single comment's thread. Return to all comments →
Below is a much easier solution:
static int[] permutationEquation(int[] p) {
int[] resultArr = new int[p.length]; for(int i=0; i<p.length; i++) { resultArr[p[p[p[i]-1]-1]-1] = p[i]; } return resultArr; }
Sequence Equation
You are viewing a single comment's thread. Return to all comments →
Below is a much easier solution:
static int[] permutationEquation(int[] p) {