Interview Question

Share Lesson

# Generate All Permutations

**Write a function generatePermutations that finds all the of an input string.**

- If there are duplicate letters, you should include the duplicate permutations of each.
- Time and space complexity is not considered for the quality of the solution — focus on readable code.

` `

**Interactive Permutation Animation**

## Breakdown

### Validate My Answer

Our constraint says that the Big O complexity should not be factored into picking a solution. You will likely want to use recursion because the iterative solution is painfully long.

Duplicate strings are allowed in the result if they form the same permutation. You only need to focus on creating the logic for the permutations without needing to validate.

Any recursive solution must have a base case. Think through what it would be here and ensure it's included in your solution.

### Generate All Permutations

**Write a function generatePermutations that finds all the of an input string.**

- If there are duplicate letters, you should include the duplicate permutations of each.
- Time and space complexity is not considered for the quality of the solution — focus on readable code.

` `