Efficiently calculating permutations of chars of strings given the permuations of each string

StackOverflow https://stackoverflow.com/questions/22160570

  •  19-10-2022
  •  | 
  •  

Question

Consider a string list: ["a", "ab", "abc", "abd", "abcd", ...] where each subsequent string contains some portions of the previous string and the list is sorted by the lengths of the strings.

The goal is to compute the permutations of chars of each string in the list and print them. Will the permutation of chars of the previous string contributes to the calculations of the permutation of chars of the next string? In other words, given 2 sets of permutations of the strings "abc", "de", is it possible to combine these permutations such that the result is the permutation of "abcde"?

Edit: If so, will it be faster than directly calculating the permutation of each string seperately?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top