microsoft/qdk

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
billt/revert-mimalloc

Branches

Tags

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

Clone

HTTPS

Download ZIP

katas/content/deutsch_jozsa/implement_dj/Solution.qs

17lines · modecode

1namespace Kata {
2 open Microsoft.Quantum.Measurement;
3
4 operation DeutschJozsaAlgorithm (N : Int, oracle : Qubit[] => Unit) : Bool {
5 mutable isConstant = true;
6 use x = Qubit[N];
7 ApplyToEach(H, x);
8 oracle(x);
9 ApplyToEach(H, x);
10 for xi in x {
11 if MResetZ(xi) == One {
12 set isConstant = false;
13 }
14 }
15 return isConstant;
16 }
17}
18