Superposition
Wildcard Superposition
Difficulty: Easy ★
A database query like 1*0* matches four records. Prepare a register that holds every matching bitstring in equal superposition, and nothing else.
Objective
prepare_uniform_state(pattern) receives a string of '0', '1' and '*' (rightmost character = qubit 0) and returns a len(pattern)-qubit circuit whose state is the uniform superposition over all bitstrings matching the pattern.
Constraints
- No initialize / state_preparation shortcuts.
Entry Point
prepare_uniform_stateChecks
- Exports prepare_uniform_state(pattern).
- Patterns such as "1*0*" and "*1*1*" give the right superposition.
Your Code
Outputpending
Execution results will appear here.