Be the first user to complete this post
|
Add to List |
126. Generate All Permutations of a String (Well-Ordered)
Objective: Write an algorithm to Print All the Well Ordered Permutations of a Given String.
What is a Well Ordered String: When all the alphabets in a string occur in increasing order irrespective of Lower Case or Upper case.
Example :
"Sample" - Not Well Ordered. "Now" - Well Ordered. N<o<W. Input: Interview Output:e, e, I, i, n, r, t, v, w][e, e, i, I, n, r, t, v, w]
Approach:
- Get the input string.
- Find out all the permutations of a String.
- Check if the permutation is well formed and add it to Set ( to remove duplicates)
- Print Set at the end
Output:
Given String - Interview [e, e, I, i, n, r, t, v, w] [e, e, i, I, n, r, t, v, w]
Reference-
http://www.careercup.com/question?id=6206517812396032