Ex7 3

$\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\ 7.3}$

Let $f$ and $g$ be functions from the space of $n$-bit strings to the space of $m$-bit strings. Design a quantum subroutine that changes the sign of exactly the basis states $\ket{x}$ such that $f(x) = g(x)$, where $x$ and $y$ are both $n$-bit binary strings, and which is efficient if $f$ and $g$ have efficient implementations.