Solution

ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2025/ii/paper-3/10c/a/solution

Write . Since the marked word is , the required oracle is a single Toffoli gate with and as its two controls and the answer qubit as its target:
The target flips exactly when both controls are one, which is exactly when .

New to topics? Read the docs here!