Permutations Ii Leetcode Solution Python