7. The Brazilian IMO leader chooses two natural numbers $n$ and $k$ with $n>k$, and then tells these to his deputy and a participant. The leader then whispers a binary sequence of length $n$ into the deputy's ear. The deputy writes down all binary sequences of length $n$ that differ from the leader's sequence at exactly $k$ positions. (Example for $n=3$ and $k=1$: If the leader chooses 101, the deputy writes down 001, 100, 111.) The participant looks at the sequences written down by the deputy. Now the participant tries to guess the original sequence from the leader.

How many times does he need to guess at minimum (depending on $n$ and $k$) to ensure he guesses correctly at least once?
Remark: A binary sequence of length $n$ is a sequence of length $n$ that consists only of 0 and 1.

Solution: If we consider a fixed position in the solution sequence $L$, then $\binom{n-1}{k}$ of the listed sequences match $L$ at this position, and $\binom{n-1}{k-1}$ of the listed sequences differ from $L$ at this position. Since the participant knows $n$ and $k$, they can also calculate these values. Additionally, they can count how many of the listed sequences have a 0 or a 1 at this position and thus determine whether $L$ has a 0 or a 1 at this position, provided that $\binom{n-1}{k} \neq \binom{n-1}{k-1}$. They can do this for every position, so the solution sequence is unique for them, and they need only one guess.

If $\binom{n-1}{k} = \binom{n-1}{k-1}$, then $n-k = k$, so $k = \frac{n}{2}$. In this case, it is easy to see that the solution sequence generates the same list as its exact opposite $L^{-1}$ (if all 0s are replaced by 1s and vice versa): Every sequence on the list of $L$ differs from $L$ at half of the positions, so it differs from $L^{-1}$ at the other half of the positions and thus also appears on the list of $L^{-1}$. By symmetry, this also holds in reverse. Therefore, the lists of $L$ and $L^{-1}$ are indistinguishable, and the number of guesses required is at least 2. We now show that there can be no other sequence that generates the same list. Then the participant can eliminate all other possibilities by writing down all possible solutions and does not need to guess more than twice.

For this, the participant guesses the first number of the sequence, WLOG a 0 (since both $L$ and $L^{-1}$ are solutions, this will certainly lead to a possible solution). Then they strike out all $\left(\begin{array}{c}n-1 \\ k\end{array}\right)$ sequences that start with a 1 and strike out the 0 at the first position in all others. What remains (assuming the 0 was correct) are all sequences of length $n-1$ where $k$ entries have been changed. Since $k \neq \frac{n-1}{2}$, the solution is now unique for the participant according to the first case. The case with 1 works completely analogously. Therefore, there can be no other solutions.