|
面试时最经常被问到的问题(Frenquently asked interview questions)之Analytical, puzzles, and brain-teasers篇(4) 9x3 = 27 27+2 = 29 so it had to be 30$ in order to be correct right? No, because you have to add 3$ and not 2. You think it would be right if you add 2$ because the tip is that amount. But the tip is already included in the multiplication. So the maths aren't right, it should be 9x3+3 and not 9x3+2. 6."You have b boxes and n dollars. If I want any amount of money from 0 to n dollars, you must be able to hand me 0 to b boxes so that I get exactly what I request." The two questions were " What are the restrictions on b and n, and how is money distributed among the boxes?" The trick is of Binary Numbers
2^0=1 2^1=2 2^2=4 2^3=8 2^4=16 .... ... 2^7=128 ...
The formula is [log n to base 2] + 1 = b
|