I mixed up all my keys!

Logic Level 3

You have 101 101 keys to 101 101 padlocks, but unfortunately they have all been mixed up!

How many times must you try at most in order to match each key to its respective padlock?

4950 10201 5151 5050

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Ethan Mandelez
Nov 29, 2020

In the worst case scenario:

In order to match your first key to the correct padlock, you need at most 100 tries. In order to match your second key to the correct padlock, you need at most 99 tries. Therefore, we need to calculate the value of 100 + 99 + 98 + … + 1 + 0, which is 5050.

Another way is by using the standard results of summation, i.e. i = 1 100 = 100 × 101 2 = 5050 \sum_{i=1}^{100} = \frac {100 \times 101} {2} = 5050

Ethan Mandelez - 2 months, 1 week ago
Pop Wong
Apr 3, 2021

Let

  • N N be the number of keys and padlocks.
  • T T be the number, at most, you need to try

N = 1 N=1

You don't need to try, the key must match the padlock,

T = 0 T=0

N = 2 N=2

You pick up a key and try a padlocks fail. The key must match the other padlock and it remains 1 key and 1 padlock, i.e. N=1

T = 1 + 0 \therefore T=1 +0

By induction, for any given N > 0 N > 0 , we can prove T = i = 0 N 1 i T = \sum\limits_{i=0}^{N-1} i

For N = 101 N = 101

T = i = 0 100 i = 5050 T = \sum\limits_{i=0}^{100} i = 5050

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...