Find all Permutations of a String

Given a string, our task is to find all permutations of a string. A Permutation is also called an arrangement of things. 
A string of length N has N! (factorial) permutations. Want to learn more about permutation follow this link "Permutations".

For example:
Input: "PRO"
Output: ['PRO', 'POR', 'RPO', 'ROP', 'OPR', 'ORP']

This native method to solve this problem using backtracking. This problem can be solved easily using the itertools module.


Thank you so much for reading this article, if you like this question please share this with your friends who love programming. And if you have questions or feedback please drop a comment.

To solve more problems, please check out this article "Top 10 String Interview Questions".

All the best!

Comments

Popular posts from this blog

Reverse Words in a Sentence Without using any Library

Top 10 String Interview Questions

Remove Duplicate from Array in Place in Python