Generate Wildcard Binary Strings
Problem statement
pattern contains 0, 1, and ?. Replace every wildcard independently with either 0 or 1 and return every resulting binary string in lexicographic order.
Function
expandWildcards(pattern: String) → String[]Examples
Example 1
pattern = "01?0"return = ["0100","0110"]The one wildcard produces two strings.
Example 2
pattern = "0??0"return = ["0000","0010","0100","0110"]Two wildcards produce four strings.
Constraints
0 <= pattern.length <= 20.