Generate Wildcard Binary Strings
Updated
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.
More Bloomberg LP Phone Screen questions
- Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
- Recommend Films from Viewers Who Watched Everything You DidPHONE SCREEN · Seen Nov 2026
- Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
- Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Sparse Vector and Matrix OperationsPHONE SCREEN · Seen Oct 2026
Similar questions at other companies
- DFS Subsequences of a String (For MLE)CoinDCX · PHONE SCREEN
- Enumerate Weekly Work SchedulesAgoda · PHONE SCREENAgoda interview questions
- Largest Number Below N from Reusable DigitsByteDance · PHONE SCREENByteDance interview questions
- All Balanced Strings from Minimum Parenthesis InsertionsRubrik · ONSITE INTERVIEWRubrik interview questions
- Phone-Number Letter CombinationsHeadway · PHONE SCREENHeadway interview questions
- Letter Combinations of a Phone NumberLinkedIn · PHONE SCREENLinkedIn interview questions
- String Permutations in Custom Character OrderWex · OA · PHONE SCREEN
- Remove Invalid ParenthesesMygate · ONSITE INTERVIEWMygate interview questions
- Balanced Parentheses with Sequential Left DeletionsGoogle · PHONE SCREENGoogle interview questions
- Generate Strings of Length at Least ThreeMorgan Stanley · ONSITE INTERVIEWMorgan Stanley interview questions