Leetcode Problem Next Permutation Function