Skip to main content
deleted 11 characters in body
Source Link
Mark Byers
  • 843.3k
  • 202
  • 1.6k
  • 1.5k

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.

An elegant way is to use 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.

Use recursion.

  • 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.
Source Link
Mark Byers
  • 843.3k
  • 202
  • 1.6k
  • 1.5k

An elegant way is to use 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.