Runtime: 24 ms, faster than 91.48% of Python online submissions for Permutations. Memory Usage: 12.7 MB, less than 72.69% of Python online submissions for Permutations.