Skip to main content

Things I am learning from Google's foo.bar challenge



Unexpectedly one day while Googling Python commands, my browser transformed and presented me with a message:

"You're speaking our language.  Want a challenge?"

This is Google's foo.bar challenge which has lead, for some, to employment at Google.  Of course, I'm a novice Python programmer with no computer science background, so I felt entirely undeserving of an invitation.  I was actually quite reluctant to even try, assuming that the problems would be far too complex for me to handle in a language that I didn't know very well.

Anyway, I figured, what the hell?  I jumped in a little over a week ago, and am currently on level 4, but I've already learned a few things that I think are important to share for anyone who may be faced with the challenge down the road.

1) The problems themselves are not conceptually difficult.  While some of them can be classified and solved by implementing classic algorithms (which weren't apparent to me until after doing some searching around), they can be solved even without the knowledge of these algorithms.  However, the algorithms may come in handy for faster processing (see next point).

2) Brute-force solutions probably won't work.  While the problems presented may at first seem like they could be solved with a few for-loops, and may work on test cases, they may not work on much larger data sets due to timed processing constraints.  Try to come up with short-cuts for solutions.

3) Apparently, form of equations is very important.  This I found a bit weird.   In one instance where I came to a dead and was unable to understand why my solution was not verifying as correct, I asked a friend to look over my work.  He came to the exact same conclusion, except he implemented a reduced form of a mathematically identical equation.  For some reason Google preferred the reduced form.  Hm.  So the point is, if the equation can be reduced, reduce it.

4) There may be inconsistencies in some problems (I'm wincing while typing this).  Now, I don't want to go on record at suggesting Google got something wrong, but without being specific to any of their challenge questions, there was one instance in which my solution worked only if I removed constraints suggested in the framing of the problem.  I suppose my interpretation could have been way off, but I double checked with a couple colleagues and they made the same assumptions.  Anyway, my suggestion:  if you find yourself at a dead end, try removing conditions based on your assumptions framed in the problem.  You may be surprised.

5) Sometimes the verification and submit system fails, to no fault of your own.  This happened on my very first problem, and I came very close to giving up because of it.  I kept getting an error when I tried verifying my solution.  Assuming that there couldn't possibly be anything wrong with Google's system, I kept trying to debug my code.  After a couple hours, I searched around and found that I wasn't the only one who had experienced this.  If you run into unexpected errors, look them up!  It may be that you just have to wait a bit and try resubmitting later.

As I go along, I may add some more to this list.


Update on April 20th, 2017:
At the moment I've taken a break from the challenge to work on other projects.  So far it's been a great learning experience and I hope to come back to it soon!

Comments