# Q: There are 5 locks and 5 keys and each of the 5 keys matches each of the 5 locks. What is the minimum and the maximum trial numbers of attempts needed to confirm that each of the 5 keys matches each of the 5 locks?A. 5,15 B. 4,15 C. 5,10 D. 4,10 E. 5,20

Well, clearly if the first 4 keys are all correctly matched with the appropriate lock, we already know that the last key will be paired with the remaining lock. So we know that the minimum number of attempts is 4. That leaves B and D.

So let’s consider a worst case scenario to determine what the maximum number of attempts should be: Say we start with Key A. At most, it will take four tries to determine which lock this key should be paired with. (We try Lock B, C, D, and E before we realize it will only work with A.) So that’s 4 attempts.

Now we’re left with four keys and four locks. If we hit more bad luck, when we try to pair key B with the right lock, it will take us an additional three attempts. (We try lock C, D, and E, before seeing what the right match is.) That’s 3 more attempts.

Now we have three keys and three locks. If we repeat this process with key C, the worst case scenario is that we attempt Lock D and E first, or 2 more attempts.

Now we have two keys and two locks. Worst case, we have one unsuccessful attempt with key D. At this point we’ll have only one lock remaining.

Max attempts: 4 + 3 + 2 + 1 = 10.