Proofs of Algorithm Correctness and Runtime Estimates · Guessing a Number

Lesson 4

Nikolai Chukhin · Alexander S. Kulikov

Programming problem. The strategy described above is called adaptive since your next question depends on the answers for your previous questions. Can you guess \(x\) by asking at most four non-adaptive questions?

To do this, implement a function \(\texttt{get\_{questions}}\) that returns four subsets of \(\{0,1,\dotsc, 15\}\), and a function \(\texttt{guess\_{number}(answers)}\), that gets a list of four bits (answers for the four questions) and returns \(x\).

5 points
Public samples
Public sample 1
Input
(empty)
Expected output
1