microsoft/qdk

Public

mirrored fromhttps://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/marking_oracles/palindrome/Solution.qs

12lines · modecode

1namespace Kata {
2 operation Oracle_Palindrome (x : Qubit[], y : Qubit) : Unit is Adj + Ctl {
3 let N = Length(x);
4 within {
5 for i in 0 .. N / 2 - 1 {
6 CNOT(x[N - 1 - i], x[i]);
7 }
8 } apply {
9 ApplyControlledOnInt(0, X, x[... N / 2 - 1], y);
10 }
11 }
12}
13