Given a string S. The task is to print all permutations of a given string.
ABC ACB BAC BCA CAB CBA
Given string ABC has permutations in 6
forms as ABC, ACB, BAC, BCA, CAB and CBA .
ABGS ABSG AGBS AGSB ASBG ASGB BAGS
BASG BGAS BGSA BSAG BSGA GABS GASB
GBAS GBSA GSAB GSBA SABG SAGB SBAG
SBGA SGAB SGBA
Given string ABSG has 24 permutations.
You don't need to read input or print anything. Your task is to complete the function find_permutaion() which takes the string S as input parameter and returns a vector of string in lexicographical order.
Expected Time Complexity: O(n! * n)
Expected Space Complexity: O(n)
1 <= length of string <= 5
We strongly recommend solving this problem on your own before viewing its editorial. Do you still
want to view the editorial?
Login to access your submissions.