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/Verification.qs

26lines · modecode

1namespace Kata.Verification {
2 open Microsoft.Quantum.Katas;
3
4 function F_Palindrome(args : Bool[]) : Bool {
5 let N = Length(args);
6 for i in 0 .. N / 2 - 1 {
7 if args[i] != args[N - i - 1] {
8 return false;
9 }
10 }
11 return true;
12 }
13
14 @EntryPoint()
15 operation CheckSolution() : Bool {
16 for n in 2 .. 6 {
17 if not CheckOracleImplementsFunction(n, Kata.Oracle_Palindrome, F_Palindrome) {
18 Message($"Test failed for n = {n}");
19 return false;
20 }
21 }
22
23 Message("Correct!");
24 true
25 }
26}
27