The Lounge is rated PG. If you're about to post something you wouldn't want your
kid sister to read then don't post it. No flame wars, no abusive conduct, no programming
questions and please don't post ads.
#SupportHeForShe Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun
To enter our office area, you must tap the correct four digit code on the keypad by the door. For some strange reason, the checking is implemented as pipeline: The last four digits typed must be the correct ones. So, if the correct code is 2345 and you start typing 1234 the door won't open. Then you add the 5, and the door opens.
In other words: You have tested two 4-digit keystrokes by 5 keypresses.
Problem 1: What is the minimal number of keypresses required to go through all 10000 possible coded? Problem 2: Describe the algorithm for generating the order of keypresses Problem 3: Prove that this is the minimal number of keypresses Problem 4: The average number of codes you have to try to find the right one is 5000. How many keypresses have you made before having tried 5000 codes? Does it depend on the order of these keypresses?