How’s the time complexity turns out to be O(n*n!) ?
can you explain?
Permutations using backtracking
Note that there are n! permutations and it requires O(n) time to print a a permutation.So it is O(n*n!)
How does it require O(n) to print a permutation?
If the length of string is n,then we need to print n characters.So O(n) complexity.