microsoft/qdk

Public

mirrored from https://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
alex/pythontelem

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

katas/content/distinguishing_unitaries/cnot_direction/Solution.qs

8lines · modecode

1namespace Kata {
2 operation CNOTDirection (unitary : (Qubit[] => Unit is Adj + Ctl)) : Int {
3 use qs = Qubit[2];
4 within { X(qs[1]); }
5 apply { unitary(qs); }
6 return MResetZ(qs[0]) == Zero ? 0 | 1;
7 }
8}
9