Problem Statement
Given an integer where , 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 1st qubit.
- You can apply the quantum gate to the -th qubit of the quantum circuit as follows:
qc.g(i)- Please refer to Construct circuits - Qiskit for circuit examples and the What quantum gates can be used? for available quantum gates.