A simple method to rearrange arr [ 0. . n - 1 ] ' ▁ so ▁ that ▁ ' arr [ j ] ' ▁ becomes ▁ ' i ' ▁ if ▁ ' arr [ i ] ' ▁ is ▁ ' j
def rearrange ( arr , n ) : NEW_LINE INDENT for i in range ( n ) : NEW_LINE DEDENT