• + 0 comments

    The explanation is correct and it is a good approach. However, the sequence (according to the hackerrank output) could not be generated, especially if one is coding in python. I don't know if others coding in different language or python is facing the same problem. def permutationEquation(p): l=[] for i in range(1,len(p)+1): l.append(p[p[i-1]-1]) return l

    where p is the array of integers containing p(x).

    Can anyone help this out?