Problem Statement
You are given an integer n.
Implement the following operation on a quantum circuit qc with n qubits for an arbitrary bit string.
∣x0x1⋯xn−1⟩nqc∣xn−1x0x1⋯xn−2⟩n
Constraints
- 2≤n≤10
- The circuit depth must not exceed 30.
- Global phase is ignored in judge.
- You cannnot use Qiskit's SwapGate in this problem.
- 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
- n=2:
Implemented circuit qc should perform the following transformation.
⎩⎨⎧∣00⟩qc∣00⟩∣10⟩qc∣01⟩∣01⟩qc∣10⟩∣11⟩qc∣11⟩