This is exercise is an original, so please work with me to see if there is any mishaps.
Given any string, choose a random position in this string, and place a copy of the original string there.
Example: "abcd" -> "ababcdcd". It could have equally likely been "abcabcdd" or "aabcdbcd" or even "abcdabcd".
Now given a string resulting from this operation, return the possible original strings:
Example: "xyxyzz". The solution will contain this item: xyz (from "xyxyzz). There will not be any other alternative in this case.
The algorithm data specification is to take a string as input and to return a list of strings as output. Each item in the output should be mappable through the self copy operation to the input string.
Given any string, choose a random position in this string, and place a copy of the original string there.
Example: "abcd" -> "ababcdcd". It could have equally likely been "abcabcdd" or "aabcdbcd" or even "abcdabcd".
Now given a string resulting from this operation, return the possible original strings:
Example: "xyxyzz". The solution will contain this item: xyz (from "xyxyzz). There will not be any other alternative in this case.
The algorithm data specification is to take a string as input and to return a list of strings as output. Each item in the output should be mappable through the self copy operation to the input string.