Challenge B2

Distinguish H from X
You need to login to be able to submit solutions!

You are given an operation that implements a single-qubit unitary transformation: either the Hadamard gate (H gate) or the bit-flip gate (X gate).

Your task is to perform necessary operations and measurements to figure out which unitary it was and to return 0 if it was the H gate or 1 if it was the X gate.

You are allowed to apply the given operation exactly twice.

You have to implement an operation which takes a single-qubit operation as an input and returns an integer. The operation should have the following signature:

An unhandled error has occurred. Reload 🗙