![]() |
VOOZH | about |
Given a list of permutations of any word. Find the missing permutation from the list of permutations.
Examples:
Input : Permutation_given[] = {"ABCD", "CABD", "ACDB",
"DACB", "BCDA", "ACBD", "ADCB", "CDAB",
"DABC", "BCAD", "CADB", "CDBA", "CBAD",
"ABDC", "ADBC", "BDCA", "DCBA", "BACD",
"BADC", "BDAC", "CBDA", "DCAB"};
Output : DBAC DBCA
Approach:
Implementation:
DBAC DBCA
Time Complexity: O(n!) where n is the length of the first string in the input
Auxiliary Space: O(n!), because we need to store all possible permutations of the input string in memory