Writings Photos Code Contact Resume Me
2 to the power what = 2 gigs ?
Submitted by msameer on Fri, 17/03/2006 - 6: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!

Syndicate content  digg  bookmark

Submitted by Anonymous (not verified) on Fri, 17/03/2006 - 8: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 - 8: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 Sat, 18/03/2006 - 12:25am.

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

Submitted by Anonymous (not verified) on Sun, 19/03/2006 - 6: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.

Post new comment
The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <b> <dd> <dl> <dt> <i> <s> <li> <ol> <u> <ul> <br> <br />
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use BBCode tags in the text, URLs will automatically be converted to links.
  • Lines and paragraphs break automatically.
  • You may write mixed Arabic and English freely, line direction will be computed automaticaly

More information about formatting options