Dsa
Recursion
Easy
All Permutations of a String
Write a function that generates all permutations of a given string and returns them as a list. The order of permutations in the output does not matter.
Input Format:
A single string S (1 <= |S| <= 10), containing unique characters.
Output Format:
A list of strings, where each string is a unique permutation of the input string.
Example:
Input:
abc
Output:
['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
Key concepts
recursionstringspermutations
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now