microsoft/qdk

Public

mirrored fromhttps://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v1.7.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

katas/content/marking_oracles/kth_bit/solution.md

6lines · modepreview

Since the effect of this oracle depends only on the value of the $k$-th qubit, we can ignore the rest of the qubits and focus on just `x[k]`. We need to flip the state of the target qubit if the input qubit `x[k]` is in the $\ket{1}$ state and leave it unchanged otherwise - this is exactly the effect of the $CNOT$ gate with the qubit `x[k]` used as control and the qubit `y` used as target.

@[solution]({
    "id": "marking_oracles__kth_bit_solution",
    "codePath": "./Solution.qs"
})