powered by
inversion(perm, i)
inversion(c(1,2,3,4,5),2)
Run the code above in your browser using DataLab