The submitted code must follow the specified format:
from qiskit import QuantumCircuit, QuantumRegister"""You can apply oracle as follows:qc.compose(o, inplace=True)"""def solve(n: int, o: QuantumCircuit) -> QuantumCircuit: x, y = QuantumRegister(n), QuantumRegister(1) qc = QuantumCircuit(x, y) # Write your code here: return qc
Sample Input
n=2,(f(00),f(10),f(01),f(11))=(0,1,0,1):
Implemented circuit qc should perform the following transformation.
41(∣00⟩+∣10⟩+∣01⟩+∣11⟩)∣0⟩qc41(∣00⟩−∣10⟩+∣01⟩−∣11⟩)∣0⟩