All about Mobile, Web, Technology, Politics, Security, E-Commerce and Living in the Philippines.

Sunday, November 22, 2009

Godie's Answers Google's Interview Questions

I love puzzles, especially puzzles in code so I couldn't resist answering the recently published "15 Google Interview Questions That Will Make You Feel Stupid" by BusinessInsider.com to let me humor myself.

Q: How many golf balls can fit in a school bus? (Job: Product Manager)
A: As a product manager, none. Golf balls has no place on a school bus, they present as a health hazard to children and could cause a nightmarish PR event for Google. However if you insist, a school bus has an average displacement of 2511 cubic feet and given the official golf ball may not be smaller than 1.68 inches or 2.4827 cubic inch in volume. Therefore roughly 1,747,697 golf balls can be fit into a school bus without compression. Now if you say I'm wrong, then Google's calculator did an epic fail in cubic feet to cubic inch conversion because I just used that!

Q: How much should you charge to wash all the windows in Seattle? (Job: Product Manager).
A: I heard of this before and I think the answer was per square foot but I disagree, the cost would be economically not feasible so I would propose a per gallon of water and soap charging model.

Q: In a country in which people only want boys every family continues to have children until they have a boy. If they have a girl, they have another child. If they have a boy, they stop. What is the proportion of boys to girls in the country?
A: 2/3, given the probability of having a boy or a girl IS 0.5. Lets take 2 couples, one starts with a boy, the other a girl. Imposing the probability the next child of the other couple will be a boy and we end up with 2 boys and 1 girl.

Q: How many piano tuners are there in the entire world? (Job: Product Manager)
A: Every person can tune a piano! However between 0.13% and 2% of Americans are deaf, assuming the same value for the entire world population, 98% of the world population are capable of tuning a piano.

Q: Why are manhole covers round? (Job: Software Engineer)
A: So its easy to dip the other side (your weight should be enough), flip it upright by its side and roll. They can actually be put back easily as well without needing to align them properly on their correct sides. Here's actually a similar question, Why coins are round?

Q: Design an evacuation plan for San Francisco. (Job: Product Manager).
A: Everyone to the shore quick! However in case of 2012 movie like event, we simply don't.

Q: How many times a day does a clock’s hands overlap? (Job: Product Manager)
A: This one made me count. M = H + n for n=0,1,2... 22 times! But twice if you include the seconds hand.

Q: Explain the significance of "dead beef". (Job: Software Engineer).
A: Sorry I'm not from U.S. so I have no clue to the significance of the phrase, pareho ba to sa "Double Dead"? X_X

Q: A man pushed his car to a hotel and lost his fortune. What happened? (Job: Software Engineer).
A: It's a game of Monopoly and the guy who asked this is from the University of Massachusetts :D

Q: You need to check that your friend, Bob, has your correct phone number but you cannot ask him directly. You must write the question on a card which and give it to Eve who will take the card to Bob and return the answer to you. What must you write on the card, besides the question, to ensure Bob can encode the message so that Eve cannot read your phone number?
A: During high school my answer is the sum of the two numbers, during college while taking BSCS the answer is the XOR of the two numbers, when I started working we just sent md5 hashes. LOL

Q: You're the captain of a pirate ship and your crew gets to vote on how the gold is divided up. If fewer than half of the pirates agree with you, you die. How do you recommend apportioning the gold in such a way that you get a good share of the booty, but still survive? (Job: Engineering Manager)
A: Attention crew!, dis er gold is divided equally but if yer kill the other crew guy den you get his gold and double yer share! (everyone starts killing each other then after the last person is left standing) -- ahem, I was not finished saying de rule, now till only one crew is left and ill kill you so I get all! Arr! (Hey I'm supposed to act like a pirate right? :D)

Q: You have eight balls all of the same size 7 of them weigh the same, and one of them weighs slightly more. How can you find the ball that is heavier by using a balance and only two weighings? (Job: Product Manager)
A: Place the ball alternately for the first weighing, take note of the ball that does not even the scale. For the second weighing, use that ball and any other ball to compare.

Q: You are given 2 eggs. You have access to a 100-story building. Eggs can be very hard or very fragile means it may break if dropped from the first floor or may not even break if dropped from 100th floor. Both eggs are identical. You need to figure out the highest floor of a 100-story building an egg can be dropped without breaking. The question is how many drops you need to make. You are allowed to break 2 eggs in the process. (Job: Product Manager)
A: 50 drops, 1st sacrifice an egg, check if the eggs will break at 50th. If yes, start from 1st floor going to 49th. If no, start from 51 going up.

Q: Explain a database in three sentences to your eight-year-old nephew. (Job: Product Manager)
A: This is a genie in a box, you ask the genie to keep your stuff in the box and all will fit in, make changes to it or throw it out if you don't need it. If you need it back, you need to describe that item to genie but the genie may bring more that 1 stuff out that fits your description. The better you describe what you need back the more chances he genie will take out what you need.

Q: You are shrunk to the height of a nickel and your mass is proportionally reduced so as to maintain your original density. You are then thrown into an empty glass blender. The blades will start moving in 60 seconds. What do you do? (Job: Product Manager)
A: Its the 2nd time this is published, correct answer is lay down if you don't want to die, but if you're like me who prefer to see a messy ending (that's why we throw you in the blender on the first place), try jumping up and down for maximum effect.

So for those who likes puzzle questions like me, try to figure this one I made myself:

//Copyright by Roger Filomeno 2009, released under CC-BY license

$r = array(); //I'm lazy, just replace with proper input array

if (count($r[0]) != count($r)) die("invalid!");
$n = count($r);
for($j=0;$j<$n;$j++)for($k=0;$k<$n;$k++)$i[$k][$j]=($j==$k)?1:0;
for ($j=0;$j<$n;$j++)for($k=$n;$k<(2*$n);$k++)$r[$k][$j]=$i[($k-$n)][$j];
for($l=0;$l<(n-1);$l++)
{
  for($j=$l;$j$r[$l][$x])?$a:$j;
    }
    for($k=0;$k<(2*$n);$k++)
    {
      $y = $r[$k][$j];
      $r[$k][$j] = $r[$k][$x];
      $r[$k][$x] =$y;
    }
  }
  for($b=$l;$b<($n-1);$b++)
  {
    $z = $r[$l][($b + 1)]/$r[$l][$l];
    for ($c = $l; $c < ($n * 2); $c++)
    {
      $y = $r[$c][($b + 1)] - ($z * $r[$c][$l]);
      $r[$b][($b + 1)] = $y;
    }
  }
  if ($r[$l][$l]==0)die("not found");
}
for($a=($n-1);$a>0;$a--)
{
  for($j=$a;$j>0;$j--)
  {
    $x=$r[$a][($j-1)]/$r[$a][$a];
    for($k=$a;$k<(2*$n);$k++)
    {
      $y=$r[$k][($j-1)]-($x*$r[$k][$a]);
      $r[$k][($j-1)]=$y;
    }
  }   
}  
for ($a = 0; $a < $n; $a++)
{
  $x = $r[$a][$a];
  for ($k = $a; $k < ($n*2); $k++)
  {
    $y = $r[$k][$a]/$x;
    $r[$k][$a] = $y;
  }
}
for ($j = 0; $j < $n; $j++)for ($k = 0; $k < $n; $k++) $i[$k][$j] = $r[($k + $n)][$j];

var_dump($i);

Saturday, August 08, 2009

Google Voice Hack for mobile users

Last week I unveiled the Google Voice Hack which all allows non-US users to register and call US for Free from GTalk. Today im going to share another trick how to use this hack for mobile after a reader sent me the following e-mail:

Your blog about Google Voice hacks
8:18 AM (15 hours ago)

I have a Google Voice account and live in Japan. What software hack did you find to call to the US with this? I would really like to call my grandmother since she doesn't understand things like Gtalk or Yahoo Messenger, and my cellular phone costs too much.

Thanks!

Michele (last name hidden)


Well currently Google voice supports Blackberry and Android but it goes through the native dialer so you can't use that to call for free when you're outside US. So here is the trick to bypass that:
  1. After using the Google Voice hack, use Gizmo5.com's Phone client to receive calls via SIP.
  2. Open your phone browser to www.google.com/voice/m
  3. from the site enter the US number you wish to call.
  4. It will then ring your Gizmo5.com's Phone client, answer it.
  5. Wait while it rings the US number and connects you.
  6. The US receiver doesn't need to use this hack, they will receive the call like any other ordinary local call via their mobile or land-line phone.
Take note however that this trick uses data rather than native call so depending on your phone subscription it should be lots cheaper compared to calling US as an international call. Finally if your phone supports WIFI connectivity then just find a free hot-spot and call for free!

Saturday, August 01, 2009

Google Voice Hack: FREE Outgoing Call to US

voice_logo_sm

Today I'm unveiling the most anticipated hack for Google Voice which I have shared during the 1st Google Technology Users Group Philippines (GTUG PH) meet-up.

Here are the steps:

  1. Get Gizmo account from Gizmo5.com, take note of your Gizmo SIP number.
  2. Download and install the Gizmo for windows app.
  3. Sign-up for IPkall.com number and use the following details details:
    - Account type = SIP
    - SIP phone number = Gizmo SIP number (no spaces,dash,parenthesis)
    - SIP proxy = proxy01.sipphone.com
    Note: takes about 3 days to be approved, you will receive an email
    with your new US number. This will give you already an incoming call capability but no free outgoing calls, we need Google Voice for that.
  4. Reserve Google Voice account at http://voice.google.com, it takes about 5 days to get an invite.
  5. AFTER receiving both the IPkall Number and Google Voice invite,
    Download UltraSurf from http://www.ultrareach.com/. You will need this to register for Google Voice since only US IP is allowed.
  6. Login to Gizmo5 desktop app then use UltraSurf proxy and sign-up for Google Voice account using invite link sent to your email.
  7. Use your IPkall US number when prompted by Google Voice.
  8. Confirm you have a US phone number by receiving a call on Gizmo5 app, type the security code from Google Voice site using the Gizmo5 app's dial pad. Just keep repeating to input the security code (usually 1 to 2 digits) with a short pause
    between attempts until it hangs up.
  9. Google voice will recognize the code and redirects the page to your
    dashboard.
  10. Configure Gizmo5 call forwarding at http://my.gizmo5.com settings, select
    option "If no answer on Gizmo5, ring elsewhere (Call Hunting)" and
    forward it your Gtalk account. Exit Gizmo5 desktop app.
  11. Using http://voice.google.com site call Google 411 at +18004664411, it
    will ring your Gtalk, accept and hear the tone ringing as it call the
    GOOG411 number. When you are able hear GOOG411 voice prompt then it
    means you have successfully configured Google Voice Hack and you will
    be able to make US calls for free and receive calls via GTalk.

I have not fully understood the Google Voice TOS but IMHO this hack basically fulfills all the requirements so you should be a legit user.

Feel free to send me feed backs!

Related Links