• + 0 comments

    It's nearly impossible to write a readable solution to such a nonsensical problem. It's bascially asking you to think in terms of POSITION instead of 0 based index. The solution to that problem is a 1 based index, hence the + 1's you see.

    Java 8 Solution:

    public static List<Integer> permutationEquation(List<Integer> intArray) {
        // Write your code here
        List<Integer> returnList = new ArrayList<Integer>();
        for(int i = 1; i <= intArray.size(); i++){
          int outterPos = intArray.indexOf(i) + 1;
          returnList.add(intArray.indexOf(outterPos) + 1);
        }
        return returnList;
    
      }