📅  最后修改于: 2022-03-11 15:03:35.132000             🧑  作者: Mango
// sequence equation hackerrank solution in javascript
function permutationEquation(p) {
// Write your code here
let arr = [];
let index = 0;
let value = 0;
for(let i =1; i<=p.length; i++){
index = p.findIndex(item => item == i);
value = p.indexOf(index + 1) + 1;
arr.push(value);
}
return arr;
}