Google Treasure Hunt: Network Question

November 5th, 2008
Network Problem

Network Problem

The network question was by far the easiest one in GTH 2008 contest.

Sample question:

Below is a diagram of a computer network. The nodes are hosts on the network, and the lines between them are links. A packet is sent out from host N with a destination of 201.107.56.70. Which nodes does the packet pass through on its way to the destination? (include start and final node in your answer)

After that, Google presented a list of nodes with their IP addresses, 3 different static routes and a default gateway. This is the entry for host N:

N 97.134.15.173 88.42.227.237 => 53.138.73.76 201.107.56.70 => 179.138.156.133 68.190.198.0/24 => 248.194.205.8 246.10.120.232

Pretty easy:

  1. A packet going to 201.107.56.70 arrives at node N
  2. Does it match 88.42.227.237 destination host? No… next try
  3. Does it match 201.107.56.70 destination host? Yes!
  4. The packet is forwarded to the host having 179.138.156.133 IP address (which is host B):
B 179.138.156.133 31.114.20.211 => 248.194.205.8 53.138.73.76 => 97.134.15.173 248.194.205.0/24 => 67.244.46.98 53.138.73.76

And so forth…

<bonus>

How would route table at host B look like?

devel@stewie:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
31.114.20.211   248.194.205.8   255.255.255.255 U     0      0        0 eth0
53.138.73.76    97.134.15.173   255.255.255.255 U     0      0        0 eth0
248.194.205.0   67.244.46.98    255.255.255.0   U     0      0        0 eth0
0.0.0.0         53.138.73.76    0.0.0.0         UG    100    0        0 eth0

</bonus>

Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • StumbleUpon
  • Meneame
  • MySpace
  • Technorati

Google Treasure Winners announced (and I’m among them)

October 22nd, 2008

Google Treasure Hunt winners abound from Official Google Blog.

Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • StumbleUpon
  • Meneame
  • MySpace
  • Technorati

Nationalization fun

October 10th, 2008

Chavez orders nationalization of Banco de Venezuela vs Gordon Brown nationalises UK banks

Fun!

Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • StumbleUpon
  • Meneame
  • MySpace
  • Technorati

Learn Catalan: Why not? / Aprendre català: Per què no?

October 8th, 2008

Vocalic sounds

Let’s start learning different vocaling sounds. In written language, we use 5 different vowels (a e i o u), however, in spoken language we use 8 different vocalic sounds (a ɛ e i ɔ o u ə).

  • A /a/
    • Written as A
    • Like English “father”
    • Examples: català, casa
  • E oberta /ɛ/
    • Written as E
    • Like French “père”
    • Examples: veig, recta, fred
  • E tancada /e/
    • Written as E
    • Like French “été
    • Examples: néixer, est
  • I /i/
    • Written as I
    • Like English “seem”
    • Examples: illa, crisi
  • O oberta /ɔ/
    • Written as O
    • Like French “robe”
    • Examples: forta, goig
  • O tancada /o/
    • Written as O
    • Like French “peau
    • Examples: honor, sanció, calor
  • U /u/
    • Written as O or U
    • Like English “food”
    • Examples: cuinar, curta, muntanya, cobrir, obert
  • Vocal neutra /ə/
    • Written as A or E
    • Like English “above”
    • Examples: casa, portes, territori
Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • StumbleUpon
  • Meneame
  • MySpace
  • Technorati

What would Adam Smith think about you guys?

October 7th, 2008

Our hypocrite capitalism is not working properly.

  1. Start up your own bank
  2. Create low-profile mortgage agencies
  3. Lend money to those who won’t be able to pay you back
  4. Sell your risks to those funny Europeans
  5. Sell your stocks before everything collapses
  6. Once your bank shares start falling you only must wait for the governmental bailout
  7. Start over. <tip>Rice and wheat speculation could be great</tip>
Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • StumbleUpon
  • Meneame
  • MySpace
  • Technorati

How did I win Google Treasure 2008? (1)

October 6th, 2008

It’s been 2 months since a nice girl at Google told me I won the Google Treasure Hunt 2008. One week ago, I got my present: a T-shirt and an engraved iPod Nano stating “Google Treasure Hunt ‘08 Winner”. I must admit I’m really surprised. I could have never imagined I had a single chance to be one of the winners. I can’t figure out how many people took part in the contest.

It’s particularly suprising given the fact that I’m not that good at maths and my prime number “skills” are scarce nowadays. It’s time now to try to explain how I managed to solve out the “games”.

The robot

A robot is located at the top-left corner of a X x Y grid (marked ‘Start’ in the diagram below).

The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked ‘Finish’ in the diagram below).

How many possible unique paths are there?

Quick facts:

  • 2×2 grid: 2 possible ways
  • 3×2 grid: 3 possible ways

So far, so good… What about a 30×40 grid?

I bet I was not the only naive guy who tried to get it by using a bruteforce 4 line Python script… OK… it took me less than a minute to realise that it wouldn’t work out (before 2040).

So…

What the heck? Let’s make use of some combinatorics.

In a 4×4 grid, the robot must move exactly 3 times to the right and 3 times downwards… So…

DDDRRR
DRDRDR

So… <hint>how many ways you can permute 3 R and 3 D in an 6 move set?</hint> I expanded that to the big grid, et voilà!

Simplicity is prerequisite for reliability.
Edsger Dijkstra

Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • StumbleUpon
  • Meneame
  • MySpace
  • Technorati

Five things you should know before visiting Barcelona

October 5th, 2008

I got to know many people who decided to visit or even staying in Barcelona during the last years. Many of them didn’t know much about our culture before landing, so hopefully I can help you to know more things about us before coming.

  1. Spanish is not the only language here: In some areas people mainly use Catalan as their daily language. Catalan and Spanish are both official in Catalunya (as well as Aranese in northwestern Catalunya)
  2. Most people don’t like bullfights at all. In 2004, Barcelona council had a vote against bullfighting.
  3. Catalan culture has few to do with other cultures in Iberian Peninsula. Iberian Peninsula has been visited by many different cultures in the last 10 centuries so, culture is really rich and different throughout Spain. Probably buying a bull, a pandereta or even a Mexican hat when visiting Barcelona is not the best idea unless you want to bring back home some kitsch souvenir.
  4. Catalan is not a minor language! 9.1 million speakers is not that few. It is spoken in different parts of Spain (Catalunya, Aragó, València, les Balears -yes, German is not the only language in Mallorca-, Murcia), also in Andorra (it is the official language in that country), in Italy (city of Alghero), and in many parts in southern France. I love figures. Catalan has more native speakers than Danish, Greek, Finnish, Slovak and other important languages in Europe.
  5. If you want to live on your own in Barcelona you will pay at least 750 euro/month for an apartment being 1000 euro/month also common. You can find a room for 400 euro/month.
Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • StumbleUpon
  • Meneame
  • MySpace
  • Technorati