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

Four Sum Problem (4sum) Solution in Java, Python, C++

Find the length of the longest substring without repeating character

Reverse Words in a Sentence Without using any Library