Skip to main content

Everything You Need to Know About Google Foobar Challenge

Google Foobar Challenge for Hiring
Recently, while searching a keyword “headless chrome” on Google I got an unusual pop-up on my window, with a message:
"Curious developers are known to seek interesting problems. Solve one from Google?"
I was surprised to see Google sending me a challenge to solve and I accepted it immediately! Clicking on “I want to play” landed me on Google’s Foobar page.

It was Google Foobar Challenge!
Google Foobar Challenge for Hiring

What exactly is Google Foobar Challenge?

Google Foobar challenge is a secret hiring process by the company to recruit top programmers and developers around the world. And it is known that several developers at Google are hired by this process.

The challenge consists of five levels with a total of nine questions, with the level of difficulty increasing at each level.

What to do after getting the challenge?

After selecting “I want to play” option you land on Foobar’s website which has a Unix-like shell interface, including some standard Unix commands like help, cd, ls, cat and etcetera.
Google Foobar Challenge for Hiring

So, the challenge begins with a sci-fi adventure storyline (in the blue text above). To begin the time-limited challenge we have to enter a request command in the shell.

After requesting the challenge, four files are added in the command-line folder: , , readme.txt and constraints.txt which we have to access using cat and ls command (listed in help).
We have a choice to solve the question either in java or python2.7 .
To start writing the code, we have to run the command edit or edit and a code editor will open-up on the same webpage (and save the code using the short-cut keys). We can verify our code at any time by running the verify file command. The code will be verified by running on several test cases of which two are visible and rest are hidden test cases. Once the code has passed all the test cases accurately, we can submit our solution to that question running the submit file command.
Google Foobar Challenge for Hiring

Five levels of foobar challenge

The level of difficulty keeps on increasing as progress further in the challenge.

Level 1: 
This level has only one question, which was pretty straightforward and easy to solve. It does not require any special algorithm to solve it. Forty-eight hours are given to solve this question.

Level 2: 
There are two questions at this stage with the time of seventy-two hours to solve each question. Both the questions were based on the basic principles of linear algebra and mathematics.

After solving both the questions at this level, we get a referral link i.e. we can invite our one friend to take Google Foobar Challenge!

Level 3: 
This is where the challenge starts to get a little tricky. To pass this level, we have to solve three questions with a time of seven days for each question.

To solve these questions, it required a good knowledge of mathematics and programming concepts like dynamic programming, Markov’s chaining, etc.

But you don’t need to worry if you don’t know these concepts, you can always learn these concepts online. Challenge gives you enough time to understand the concept and implement them in the given programming problem. In one of the questions, I solved the problem with the most intuitive method but it was not optimal enough for large values and required implementation of dynamic programming to get the result.
After completing level 3, we are asked to fill-out our details for being contacted by a Google recruiter!

They ask your basic information: name, phone number, email address, country, CV (optional), and if you are a student or a professional.

Google Foobar Challenge for Hiring recruitment form
Foobar Recruitment Form

Level 4:

I found this level the most difficult of all the five. It required the implementation of several concepts to solve a single problem. There are a total of two questions at this level and time of a total of two weeks is given to solve each question. 

Extensive knowledge of algorithms and data structures is required at this level.

The first question was based on the concept of number theory and graphs. I had to implement the Bellman-Ford algorithm in order to solve this question.

It took me a lot of time to understand these concepts and implement them to solve these questions. But I was able to solve both of these questions on time.

After successfully completing level 4 you get another referral link to invite your one more friend to try this challenge!

Level 5:

This was the second hardest problem of the whole challenge and was based on a purely mathematical concept. The final level only had a single question and twenty-two days were given to solve that problem!

The problem required understanding of permutations and combinations and implementation of the Pólya enumeration theorem and Burnside’s lemma. After understanding these two theorems coding part was pretty much simple.

With the submission of this question, the Google Foobar Challenge is completed!

Google Foobar Challenge for Hiring
 Foobar Challenge Completed

After ending the challenge, I got an encrypted string which was easy to decrypt using base64.

import base64
my_eyes=str.encode("MY USER NAME")
for i in range(0,len(decoded)):
  decrypted+=chr((my_eyes[i%len(my_eyes)] ^ decoded[i]))

This was the code I used to decrypt the message. The decrypted message was:


What will happen after completing the challenge?

After the successful completion of all the five levels, chances are that you will be contacted by Google's recruiter for an interview.
You may receive an email or a phone call and if you cracked the interview then you can be hired at Google.

How to get Foobar Challenge?

Unfortunately, this challenge is not available to everyone and Google sends it only to specific developers (it may be based on their search history - technical keywords).

Don't worry if you didn't get this invite yet, this is not the only way to get a job at Google.
Don't find Foobar, let Foobar find you!
Google Foobar Challenge for Hiring


I would say this is a great opportunity to learn and I would recommend you to solve the questions if you get an invitation.
While solving the problems don't keep your aim to get hired at Google but to learn the new techniques and experience one of the best coding challenges.
Foobar is more about learning and implementing, instead of knowing everything before!

To improve your code check out our article here.

If you have any queries or comments, please post them in the comment section.


Post a comment

Popular posts from this blog

Complete Data Visualization Guide: Python

“A picture is worth a thousand words” -Fred R. Barnard  Data visualization is a visual (or graphic) representation of data to find useful insights (i.e. trends and patterns) in the data and making the process of data analysis easier and simpler. Aim of the data visualization is to make a quick and clear understanding of data in the first glance and make it visually presentable to comprehend the information. In Python, several comprehensive libraries are available for creating high quality, attractive, interactive, and informative statistical graphics (2D and 3D).

What are Classification and Regression in ML?

(Photo by Gertrūda Valasevičiūtė on Unsplash ) ML is extracting data from knowledge. Machine learning is a study of algorithms that uses a provides computers the ability to learn from the data and predict outcomes with accuracy, without being explicitly programmed. Machine learning is sub-branched into three categories- supervised learning, unsupervised learning, and reinforcement learning. (Image by Author) Machine Learning Model Supervised learning As the name "supervised learning" suggests, here learning is based through example. We have a known set of inputs (called features, x) and outputs (called labels, y ). The goal of the algorithm is to train the model on the given data and predict the correct value (y) for an unknown input (x). Supervised learning can be further classified into two categories- classification and regression. Classification and regression are two basic concepts in supervised learning. However, understanding the difference between the two can be co