I recently got to know about the secret google foobar challenge. This used to be one of the ways to hire python and java developers back in 2016–2017.
How did i get an invite ?
The secret to getting this challenge is to simply search ArrayList Java in a couple of tabs without closing anyone. After a while one of the tabs would get an invitation like above where your window slides open and a challenge is presented. Cool Huh!.
- Many People have reported getting this challenge while browsing through google developers documentation.
- If you still can’t find the invite feel free to reach out to me for a referral link to google foobar challenge. (Since you can only refer 2 more people, It’s first come first Serve)
I have been lucky enough to get this invite twice via google search on 2 different google accounts.
After you accept the invite you are greeted with the following screen.
Just Sign in with one of the google accounts and foobar will save your progress.
Navigating The Interface
You are welcomed with an interface similar to linux terminal. You can start by typing help to get the most useful commands.
ls: list the contents of the current working directory.
This will show you 2 files. journal.txt contains the story line so far and start_here.txt tells you how to start getting problems.
you can use the cat command to print the contents of this files.
request: enter this command to request a new challenge. A new folder with the problem name is created in current directory.
Inside it contains 4 files
- Readme : Contains problem description
- Constraints: Provides a general ranges of variables and input ranges
- Solution.java and Solution.py (Edit this files to enter your solution)
Google Foobar consists of 5 levels and each level is more daunting than before. (But you as a curious body will find a way ;) )
It starts with a story where the villain (Commander Lambda) is trying to takeover a bunny planet and has enslaved the bunnies. Our task is to save the bunnies. You have infiltrated the villain’s ship and now have to solve a few problems to rescue the bunnies and escape.
First Level : You get 1 problem which is an easy interview problem. you get 7 days to solve it.
This is the bunny animation along with the progress bar at the bottom we get to see after successful submission.
Second Level: You get 2 problems which are mostly related to famous algorithms like BFS, DFS, Stack, Dynamic Programming. You can also get math related programming problems. You get 7 days to solve each problem. After Completing this round you get 1 referral link through which you can let other people enter foobar
Third Level: This time you have 3 questions usually ranging from dynamic programming and various data structures . There can be questions on partitions or number theory as well. (I loved reading my math books again)
This time you get 15 days to solve each problems.
After the 3rd level, you are asked to fill out details for being contacted by a Google recruiter. This could provide to be a wonderful opportunity to send your resume to google recruiter.
Fourth Level : This is where things start heating up. In this level you only get 2 problems. This is supposedly hard than all the previous problems up till now. For One Of the Problems I had to revisit my graph concepts again and decided to refresh on Max Flow Algorithms.
This time again you get 15 days to solve each problems
Once you are done with all the problems on this level you get another referral for google foobar challenge.
Fifth Level : This level has only 1 problem and you get 22 days to solve this. This was a hard problem to me as i had no idea how to approach this. I took some time off to refresh on my concepts from Automata Theory and come back to solve the problem again. Later I figured out a simple dynamic programming and hash map approach would work and submitted the final Problem.
After Solving this problem you will see 5 hoping bunnies indicating the end of the challenge.
After completing the challenge you get a base 64 encrypted message which on decryption become the following json.
'success' : 'great',
'colleague' : 'esteemed',
'efforts' : 'incredible',
'achievement' : 'unlocked',
'rabbits' : 'safe',
'foo' : 'win!'
- Do Check Constraints.txt . Your Favourite library may not be supported and hence you need to write any extra functions or classes.
- There are no separate indicators for Time Limit Exceeded and incorrect answers. It’s either Test Case Passed or Test Case Failed. So make sure you have well tested the code well and have calculated the Time Complexity.
- Do check for corner cases. With So Much time on hand it’s better to find a solution on paper first and then code the solution. Writing lot of functions may make it easier to follow the code logic on paper and would be easy to test and troubleshoot
Google Foobar is a really fun challenge where instead of testing your speed it tests your ability to learn and apply new knowledge to solve problems. I enjoyed the mathematical part of the problems and it helped me refresh on harder algorithmic concepts like Max Flow Problems
If you wanna learn about Data Structures and Algorithms along with Graph Theory I highly recommend Checking William Fisets Course on Udemy or Youtube completely free of cost. This is a wonderful resource for beginners to learn even harder concepts in DSA and Graph Theory.