Print Permutations - String
You are given an input string 'S'. Your task is to find and return all possible permutations of the input string.
Note:
1. The input string may contain the same characters, so there will also be the same permutations.
2. The order of permutation does not matter.
Input Format:
The first and only line of input contains a string 'S' of alphabets in lower case characters.
Output Format:
Print all the permutations of the given string 'S' in a separate line.
Note:
You do not need to print anything, it has already been taken care of. Just implement the given function.
Constraint:
0 <= |S| <= 8
Where |S| denotes the length of string 'S'.
Time limit: 1 sec
CodingNinjas
author
2y
Approach :
We can find all the permutations by Backtracking.
1) Fix a character then swap all the rest of the remaining character with a fixed character.
2) Then find all permutations for all remaining ...read more
CodingNinjas
author
2y
Backtracking
We can find all the permutations by Backtracking.
1: Fix a character then swap all the rest of the remaining character with a fixed character.
2: Then find all permutations for all remainin...read more
Help your peers!
Add answer anonymously...
Top Virtusa Consulting Services Technology Consultant interview questions & answers
Popular interview questions of Technology Consultant
Top HR questions asked in Virtusa Consulting Services Technology Consultant
>
Virtusa Consulting Services Technology Consultant Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app