rewrite leetcode permutation i ii