Generate all strings by expanding wildcards

Quick Overview

This question evaluates algorithmic string manipulation and combinatorial enumeration skills, focusing on handling wildcard characters and generating all possible binary outcomes from a pattern.

Generate all strings by expanding wildcards

Company: Bloomberg

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

## Problem Given a string `s` consisting only of characters `'0'`, `'1'`, and `'*'`, replace every `'*'` with either `'0'` or `'1'` and return **all possible resulting binary strings**. You may return the results in **any order**. ## Example Input: `"01*"` Output: `["010", "011"]` Input: `"1*0*"` Output: `["1000","1001","1100","1101"]`

Quick Answer: This question evaluates algorithmic string manipulation and combinatorial enumeration skills, focusing on handling wildcard characters and generating all possible binary outcomes from a pattern.

|Home/Coding & Algorithms/Bloomberg
Bloomberg logo
Bloomberg
Dec 15, 2025, 12:00 AM
mediumSoftware EngineerOnsiteCoding & Algorithms
17
0

Problem

Given a string s consisting only of characters '0', '1', and '*', replace every '*' with either '0' or '1' and return all possible resulting binary strings.

You may return the results in any order.

Example

Input: "01*"

Output: ["010", "011"]

Input: "1*0*"

Output: ["1000","1001","1100","1101"]

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...