Permutation of a String Duplicate
All permutation of a string that has duplicate characters and lexicographic order.
Algorithm:
- If level is equal to size string then
- add character array to permutation list
- return
- Iterate character count map
- If count of character is greater than zero then
- add character to character array
- decrease character count
- recursively call with level + 1
- reset character count
- If count of character is greater than zero then
Latest Source Code:
Github: PermutationOfStringWithDuplicate.java
Output:
Permutations of "CAAB": [AABC, AACB, ABAC, ABCA, ACAB, ACBA, BAAC, BACA, BCAA, CAAB, CABA, CBAA]