How many times should the keys of a keyboard be pressed in order to type the first 500 natural numbers? (i.e. to type 1, 2, 3 ... 500) ?
Solution :
The numbers are from 1, 2, 3 ... 500.
From 1 to 9,
The keyboard pressed 9 times.
From 10 to 99,
The keyboard pressed times
The keyboard pressed 180 times.
From 100 to 500,
The keyboard pressed 3 * (500 - 100 + 1) times
The keyboard pressed 1203 times.
Total number of times the keyboard pressed is
n= 9 + 180 +1203 = 1392 times
Post a Comment