Solution (source code)

= Solution

If $f$ is constant, then
$$
|f\rangle=\pm\frac12\sum_{b_1,b_2}|b_1b_2\rangle
=\pm H^{\otimes2}|00\rangle.
$$
The sign is a physically irrelevant <global phase>.