powered by
Given a permutation and a position, swap positions i and i+1
inversion(perm, i)
The permutation in the input with an inversion at the specified position
a permutation
position of the permutation
inversion(c(1,2,3,4,5),2)
Run the code above in your browser using DataLab