Next Permutation Problem Leetcode Python