All puzzles › Quantum Computing
Quantum Computing Practice Problems
20 puzzles (9 easy, 8 medium, 3 hard), 8 free, in Python, JavaScript and C++.
Qubits, gates, superposition, Grover search, and the core ideas of quantum computing as code.
The puzzles, easiest first
- Do These Two Measurements Clash (Easy, free): A measurement on several qubits is written as a string of the letters I, X, Y and Z, one per qubit.
- Keep Only What Lined Up (Easy, free): In BB84, Alice sends each bit of a key as a photon prepared in one of two bases, written + and x, chosen at random.
- One Question per Bit (Easy, free): An oracle hides an n-bit secret.
- Outvote the Noise (Easy, free): A qubit is fragile, so one logical bit is spread across three physical ones.
- Two Bits Finish the Job (Easy, free): Teleporting a qubit takes a shared entangled pair and two ordinary bits.
- Born Rule Probabilities (Easy): Given a list of real amplitudes, return the probability of each outcome, rounded to 4 decimals.
- Most Likely Outcome (Easy): Given the probability of each outcome, return the index of the most likely one.
- Pauli-X (NOT) Gate (Easy): Given a list of qubits as 0s and 1s, apply the Pauli-X gate to each one and return the result.
- Superposition States (Easy): Given n qubits, return how many basis states they cover together.
- Find the Flip Without Looking (Medium, free): Measuring a qubit destroys what it holds, so a quantum code never looks at its data.
- How Many Layers Deep (Medium, free): A qubit loses its state within moments, so what matters about a quantum circuit is not how many gates it has but how many layers.
- Bloch Sphere Probability (Medium): Given a qubit's angle theta on the Bloch sphere, in degrees, return the chance of measuring 0, rounded to 4 decimals.
- CNOT Gate (Medium): Given two qubits as [control, target], apply a CNOT gate and return the new [control, target].
- Combined State Space (Medium): Given the dimension of each quantum system, return the dimension of all of them combined.
- Expectation Value (Medium): Given an observable's eigenvalues and the probability of each one, return the expectation value, rounded to 4 decimals.
- Grover Iterations (Medium): Given the number of items n in a search space, return the best number of Grover iterations: pi / 4 x the square root of n, rounded down.
- Normalize a Quantum State (Medium): Given a list of amplitudes, scale them so their squares add up to exactly 1, rounded to 4 decimals.
- The Period Gives It Away (Hard, free): Shor's algorithm breaks RSA by turning factoring into finding a period.
- Apply a Hadamard Gate (Hard): Given a single qubit's real amplitudes [a, b], apply a Hadamard gate and return the new amplitudes, rounded to 4 decimals.
- Grover Success Probability (Hard): Given a search space of size n and a number of Grover iterations k, return the chance of finding the marked item, rounded to 4 decimals.
Practice another pattern
Or browse by subject
Browse all 676 puzzles