Problem Statement
Given an integer , implement an -qubit oracle on a quantum circuit .
The oracle acts on basis states , where and , as follows:
Constraints
- The circuit depth must not exceed .
- Integers must be encoded by little-endian.
- Global phase is ignored in judge.
- The submitted code must follow the specified format:
from qiskit import QuantumCircuit
def solve(n: int) -> QuantumCircuit:
qc = QuantumCircuit(n + 1)
# Write your code here:
return qc
Hints
Open
- Related problem: QCoder Programming Contest 004 - A4