Problem Statement
You are given an integer . Implement the operation defined by the following matrix on a quantum circuit with qubits:
where denotes the identity matrix and is defined by
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(n: int) -> QuantumCircuit:
qc = QuantumCircuit(n)
# Write your code here:
return qc
Sample Input
- : The matrix is calculated as follows.