Why does a classical algorithm need exactly n queries to find s, while the quantum algorithm needs only one?
Think about your answer, then reveal below.
Model answer: Classically, each query f(x) returns one bit — the inner product s dot x mod 2. To recover all n bits of s, you need n linearly independent queries (the standard basis vectors e_1,...,e_n work, since f(e_i) = s_i). The quantum algorithm queries f on a superposition of all 2^n inputs simultaneously, and phase kickback encodes all n bits of s into the quantum state's phase pattern. The final Hadamard transform converts this global phase information into the computational basis state |s>, recovering all n bits at once.
This highlights a genuine quantum advantage: a single quantum query can extract n bits of information about a function through interference, while a single classical query yields only one bit. The mathematical reason is that the Hadamard transform is the discrete Fourier transform over Z_2^n, and the function f(x) = s dot x is a character of this group. The Fourier transform localizes the character to a single point — exactly the hidden string s.