Google Treasure Hunt - No solutions here, only hints

google treasure huntGoogle is holding a treasure hunt and I took a look and decided to give it a shot. I probably won’t make it all the way through, because I don’t have any low-level Linux knowledge (since low-level Linux trivia will be part of the treasure hunt). But the rest is fun.

So, begins the quest by a fun first question which talks about a robot and his quests through a grid. For some reason, the dumb robot wants to know all possible ways to reach from the upper left of the grid to the lower right of the grid. Being a programmer, my first impulse was to write a program that calculates the number of paths, and that didn’t take long. And here in lies the first hint of this puzzle:

Hint 1: Robot Puzzle: DO NOT use a computer program to do this. Even though you may get the algorithm right, it will take you millions of years to calculate Robot Puzzlethe number of paths for anything larger than trivial sizes of this grid (of course, your computer will probably run out of memory first). You can try and optimize your algorithms of course. However, I resorted to simple maths and an excel sheet.

The problem is that the answers I am coming up with (and I am sure they are correct) are being rated as incorrect by Google. I think this may be due to a silly mistake I am making somewhere.

Hint 2: The File Sum and Multiplication Problem: This one was straight forward code, which took about 5 minutes to write. Remember, those who plan to do this manually (for any reason), you won’t see line breaks in notepad.

I have submitted the answer for this one, but am awaiting whether this is correct or not. Let’s see.



You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

12 Responses to “Google Treasure Hunt - No solutions here, only hints”

  1. Okay, got it. The reason for why I was getting an incorrect answer for Number 1 is because Excel can’t handle precision to that extent.

    Back to the programming board…

  2. Rethink your programmatic solution. This problem can be solved without destroying your computer & memory.

  3. @C, yup… working on it…

  4. Well, got both of them correct… 2 of 2… yeah :)

  5. i also started with excel but found out it only handles 15 digits of precision. There is a piece of software called xlprecision that is a excel plugin that is supposed to give you many more digits but it is not available for mac.

    I opted to write a ruby program. Very straight forward, memory was no problem.

  6. [...] recent attempts at playing the Google Treasure Hunt found me looking for ways to work with very large numbers. My solution to the first puzzle was [...]

  7. @Ryan, yup… I wrote a program finally… :)

  8.   Prashant Says:

    The first one can be solved in one line of copious Haskell ;-)

  9. [...] third installment of the Google Treasure Hunt is live. I have been through the first two challenges and been successful at solving them [...]

  10. private static BigInteger linearRobot(int w, int h){
    BigDecimal num= BigDecimal.ONE;
    for(int i=1;i<h;i++){
    num=num.divide(BigDecimal.valueOf(i), 10, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(i+w-1));
    }
    return num.toBigInteger();
    }

  11. man bc for the robot question (unless you’re not fortunate enough to have unix/linux box handy).

    “bc(1)

    NAME
    bc - An arbitrary precision calculator language
    …”

    Think factorial. Beware the fencepost.

    I’ve got three confirmed and I’m cranking on the primes (last?) one in my free time. Maybe I’m missing something, but my first attack is a bit brute force. I did catch that it could be a (sort of) m+n prob instead of m*n.

    Somehow my solution (if I can call it that, I don’t yet have an answer) doesn’t feel elegant yet.

  12. I too am on the primes problem. I am still to start on it (no free time) and yes, I am also looking at brute force…

Leave a Reply