An elegant way is to useUse recursion - try each of the letters in turn as the first letter and then find all the permutations of the remaining letters with a recursive call. The base case is when the input is an empty string the only permutation is the empty string.
- Try each of the letters in turn as the first letter and then find all the permutations of the remaining letters using a recursive call.
- The base case is when the input is an empty string the only permutation is the empty string.