Solve the 'Next Permutation' question