We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
public static List<Integer> permutationEquation(List<Integer> p) {
// Write your code here
List<Integer> newList = new ArrayList<>();
int x = 1;
while (x <= p.size()) {
for (int i = 0; i < p.size(); i++) {
if (p.get(i) == x) {
newList.add((p.indexOf(i + 1)) + 1);
}
}
x++;
}
return newList;
}
Cookie support is required to access HackerRank
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 →
java 8