DEV Community

Cover image for Cracking Google's Foobar Challenge
Tasin Ishmam
Tasin Ishmam

Posted on

Google Foobar Cracking Google's Foobar Challenge

I've recently finished Google's coding challenge, Foobar. This has honestly been a really fun programming game, and I wanted to share my experience!

What is it?

Foobar is a invite only coding challenge hosted by google. The prize for completing? A chance to be recruited. Once you pass a certain level, you have the option to submit your solutions and personal info to a google recruiter. Getting an interview isn't guaranteed however and not everyone gets a response from the recruiters. However I'd recommend not to focus on that too much and just have fun. If you really want to apply to Google, there's usually easier ways.

Great, where do I sign up?

Since this is invite only, directly going to the foobar website won't help as there's no registration option. There's two ways you can get an invite.

  1. Getting an invite directly from google. This actually isn't super hard, you need to search for certain keywords like "arraylist java" or "mutex lock" on google multiple times to trigger the invite mechanism. The full mechanism is explained here.

Up for a challenge

  1. Get an invite directly from someone who is already participating. Each participant, gets a maximum of two invites upon completion of certain levels in the challenge. So if you know someone who's already doing the challenge, you could ask them as well.

The Story So Far

Upon starting you are greeted with a unix shell interface. You can interact with the shell using standard unix commands like "ls", "cat" and "cd". You find a journal entry at the very beginning which explains the situation to you.


A bunny themed Star Wars fanfic story that you have to code your way through. Sounds too good to be true ;)

The programming challenges

In order to progress in your mission you need to perform a slew of programming challenges, from fixing Commander Lambda's wardrobe to rescuing bunny prisoners from the space station. These challenges are divided into 5 progressively more difficult levels. The tasks are similar to ones you find in competitive programming websites. Foobar especially has a lot of Dynamic Programming and math problems. A brief description of the levels:

  1. Level 1: 1 problem.
  2. Level 2: 2 problems. Upon completion, invite a friend.
  3. Level 3: 3 problems. Upon completion, option to provide information for recruitment by Google.
  4. Level 4: 2 problems. Upon completion, invite another friend.
  5. Level 5: 1 final problem.

The solutions can be submitted in Java and Python 2.7 (yikes!). There's even an integrated code editor you can use. In my experience, the difficulty starts ramping up around level 3. However, difficulties tend to vary even amongst problems from the same level. One of my level 3 problems was about Markov Chains and it took me over 2 days to finish, whereas I finished the rest of level 3 in a few hours.

Grand Finale

At last, you've bested Commander Lambda's evil plans, rescued all the bunnies and saved the galaxy! You are now greeted with a mysterious encrypted message. What could it be?
After some next level hacking googling, I found out it's a simple XOR encryption. The message is XOR'd with my google username and then encoded to base64. So you can decrypt it by reversing this process. Let's use a python script to do just that

# Script source:
import base64
from itertools import cycle

key = bytes("TasinIshmam", "utf8")
print(bytes(a ^ b for a, b in zip(base64.b64decode(message), cycle(key))))

# Output: 
# {'success' : 'great', 'colleague' : 'esteemed', 'efforts' : 'incredible', 'achievement' : 'unlocked', 'rabbits' : 'safe', 'foo' : 'win!'}
Enter fullscreen mode Exit fullscreen mode
  • Take your time. Google gives you plenty of time to finish each problem (Over 20 days in case of the level 5 problem). So there's no need to hurry, research the problems thoroughly and design a optimized solution.

  • Know thy standard library. For a lot of the combinatorics type problems, the python standard library was absolutely godsend. Don't code up functions that are already provided by Python/Java's standard library.

  • Take a break between problems There's no time restriction between problems, so you can take as much time as you want before requesting a new problem. Some of these problems need a lot of time to finish, so don't rush in requesting new problems unless you're sure you have the spare time to invest on it.

  • Do Foobar to learn, not for a job Foobar probably isn't the most efficient way to get a interview at google. It's completely uncertain if and when a recruiter will respond. So instead of worrying about that, do Foobar to learn, that way you'll be under a lot less pressure.


Foobar is a great way to dip your toes into the world of programmatic problem solving. The whole thing is set up in a way so that you can learn as you go. I personally learnt a lot about Markov Chains, Backtracking and Cellular automata while doing these problems.

And if you need some more motivation, here are all the bunnies you'll be rescuing ;)

Bunny Gif

Top comments (6)

paddyredbeard profile image
Patrick B • Edited

The first time I discovered this was by googling dependency injection. That was almost 10 years ago and the "game" informed me I had 48 hours to respond (which was simply not possible for me at the time). I tried this search again recently and the experience so far has been consistent with this post. These are definitely fun exercises whether you're hoping to be recruited or just looking for a little extra-curricular challenge.

tasinishmam profile image
Tasin Ishmam

Super cool that this has existed for over 10 years 🤯. Thanks for sharing your experience!

tavdog profile image

Searching for python list comprehension did it for me.

interprimos80_ng profile image
Stephen N.

Me too

bonsoirval profile image

Please help me out how to play this game and win. thanks in advance

irisshakya profile image

same for me lol