[SOLUTION] Google Treasure Hunt – Robot

Okay! Let’s solve this programming problem without writing a single line of code. 🙂
A robot is located at the top-left corner of a 60 x 31 grid:


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.

Our robot can 30 times to step down and 59 times to step right, because it is staying on the first block (1, 1).
We can write down his way from location (1, 1) to location (60, 31) like this:
R – right, D – down.
RDRDDDRDDRDDRD……RDRRRDDDRDRD.
The only question is: how many different (unique) arrays we have from 59 R and 30 D?
Fill out a row with 59 R:
RRRRRRRRR……..RRRRRRRRRRRR……RRRRRRRRRR and take 30 D to random places without repeating an already existing array. On more mathematical language, number of unique arrays (unique permutations) with length 59+30 from 30 D is exactly:

Comments are welcome! 😉

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s