Probability Level 5

You are trying to open a challenging lock. The lock has 25 buttons on it. To open it, you should press the buttons in a certain order. When you push some button, it either stays pressed into the lock (that means that you've guessed correctly and pushed the button that goes next in the sequence), or all pressed buttons return to the initial position. When all 25 buttons are pressed in the correct order, the lock opens.


Consider an example with 3 buttons. Let's say that the opening sequence is: [2,3,1]. If you first press buttons 1 or 3, the buttons unpress immediately. If you first press button 2, it stays pressed. If you press 1 after 2, all buttons unpress. If you press 3 after 2, buttons 3 and 2 stay pressed. As soon as you've got two pressed buttons, you only need to press button 1 to open the lock.

You are going to act in the optimal way. Calculate the number of times you have to press a button in order to open the lock in the worst-case scenario.


Problem Loading...

Note Loading...

Set Loading...