Problem Statement
Given an integer , implement an oracle on a -qubit quantum circuit which satisfies the following condition:
where is the identity matrix, and is the gate.
Constraints
- 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(k: int) -> QuantumCircuit:
qc = QuantumCircuit(3)
# Write your code here:
return qcHints
Open
- means applying the gate to the st qubit.
- You can apply the quantum gate to the -th qubit of the quantum circuit as follows:
qc.g(i - 1)- Please refer to Construct quantum circuits - Qiskit for quantum circuit examples and the What quantum gates can be used? for available quantum gates.