Four pairs of keys and locks are placed on a desk. What is maximum number of times we may have to try to open all the locks?

tries

When considering extreme situations, the question is often asking either what is the worst case scenario or the best case scenario; in the case, we need to calculate the worst case scenario.

There are four possible choices of keys for the first lock, so if worse comes to worst, we won’t have the right pair until the fourth try. There are now three choices of keys for the second lock and the we may not get the right match until our third try. This pattern continues for the next two locks, so the maximum of number of tries is 4 + 3 + 2 + 1 = 10.