Skip to main content
1 of 5
DJanssens
  • 1.5k
  • 1
  • 15
  • 27

If I remember correctly, I answered a similar question yesterday Finding the given word from jumbled letters

Basically, doing permutations is going to take to long. A double for loop results in a complexity of \$O(n²)\$.

As suggested in the link, use sorting and scan linear if the output is correct or use the second approach described by thepace, which runs in \$O(n)\$.

Regarding to your python coding:

DJanssens
  • 1.5k
  • 1
  • 15
  • 27