Writings Photos Code Contact Resume
2 to the power what = 2 gigs ?

You are here

Submitted by msameer on Fri, 17/03/2006 - 4:44pm

I've been asked this question a few months ago when I was interviewed by Google, She wanted a smart way so I told her that I can use the calculator but probably that's not the answer that you want. I decided not to answer.

My idea was to multiply 2 by 2 by 2 by 2 ....... until I reach 2 gigs.

Yesterday I was going home and I don't know why did I remember this again.
I tried to solve it using binary shift and so but it didn't work.

Guess what ? An idea popped into my head, What if we take the logarithm of 2 gigs to the base 2 ?

Now that's a damn smart answer, It takes a bit of concentration to get it and when you realize that it's a simple answer you might get mad at yourself.

That's why I'm sure that I'll fail in IQ tests although I'm sure that I'm smart :-)

Looks like I failed and they didn't contact me again!


Submitted by Anonymous (not verified) on Fri, 17/03/2006 - 6:08pm

Hey, since 2^10 is kile, 2^20 is Mega, then 2^30 is Giga
So the unser must be 2^31

Submitted by theSamo (not verified) on Fri, 17/03/2006 - 6:51pm

this is basic algebra ... not "damn smart".

and i can't believe you thought about binary BEFORE thinking about this one.

Submitted by Alaa (not verified) on Fri, 17/03/2006 - 10:25pm

I don't understand how is rephrasing the question an answer?

Submitted by Anonymous (not verified) on Sun, 19/03/2006 - 4:03pm

well, I know that that max value that can be put in a signed integer(when an integer is 4 bytes) is 2 then 9 digits(I don't remember the number ofcourse), a gig is also 1 then 9 digits, so that's, now I now the number.
knowing that a signed integer contains a sign bit on the left, then 31 bits are remaining, so that's the answer.

Add new comment

Subscribe to /  digg  bookmark