A quantum solution for the quantum combination lock

For a classical solution to the quantum combination lock we always needed to perform at least as much guesses as we had digits in the secret code. This is not bad. But can we get better using the properties of qubits, namely superposition and entanglement? It turns out, we can! Let's explore how.

Investigating another black box

A common way to work with quantum algorithm is to prepare an equal superposition and use it for calculation. This is also used in the Bernstein-Vazirani algorithm we want to look into now.

!
To find out the secret 4-digit code of this black box, prepare an equal superposition of all 5 qubits. Apply a set of H also after the black box.

Afterward, open the black box and check how you can retrieve the secret code from the measurement outcomes.
Measurements
Hints
What is the secret code?
How many trials does one need to figure out the correct code with the quantum algorithm?