How to print permutations without itertools and recursive calls ?
to achieve this my friend suggested me this logic.. rotate the string and then print it and swap the characters with another.. example : input is "abc" rotating : cab bca abc now swapping the first character with second so now our new string becomes 'bac' again rotating cba acb bac like this i got permutations! but what if the length of the input is greater than 3 ? I tried to achive my goal with 4 length of string with the same logic.. but I am getting 4 duplicate values as output instead of real permutations. how to solve this problem? my attempt : https://code.sololearn.com/cw44n4fGvSWu/?ref=app