Solution to Next Permutation

the use of default sort function