Ex9 5

$\def\abs#1{|#1|}\def\i{\mathbf {i}}\def\ket#1{|{#1}\rangle}\def\bra#1{\langle{#1}|}\def\braket#1#2{\langle{#1}|{#2}\rangle}\def\tr{\mathord{\mbox{tr}}}\mathbf{Exercise\ 9.5}$

Suppose $P: \{0,\dots, N-1\} \to \{0,1\}$ is zero except at $x = t$, and suppose we are given not only a quantum oracle $U_P$, but also the information that the solution $t$ differs from a known string $s$ in exactly $k$ bits. Exhibit an algorithm that finds the solution with $O(\sqrt{2^k})$ calls to $U_P$.