The world’s leading publication for data science, AI, and ML professionals.

Foobar Challenge: Google’s Secret Hiring Process

Everything you need to know about Google Foobar Challenge

Google Foobar Challenge for Hiring(Image by Author)
Google Foobar Challenge for Hiring(Image by Author)

ULTIMATE GUIDE

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!

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.

(Image by Author)
(Image by Author)

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: solution.java , solution.py , 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 python 2.7 .

To start writing the code, we have to run the command edit file.py or edit file.java 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 thesubmit file command.

(Image by Author)
(Image by Author)

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.

Beginners Guide to Dynamic Programming

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.

(Image by Author) Foobar Recruitment Form
(Image by Author) 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!

(Image by Author) Foobar Challenge Completed
(Image by Author) Foobar Challenge Completed

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

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

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

{'success' : 'great', 'colleague' : 'esteemed', 'efforts' : 'incredible', 'achievement' : 'unlocked', 'rabbits' : 'safe', 'foo' : 'win!'}

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!

(Image by Author)
(Image by Author)

Conclusion

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!

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

To improve your code check out our article here.

(Image by Author)
(Image by Author)

Check this out: https://www.fiverr.com/share/LDDp34

Originally published at: www.patataeater.blogspot.com

Resources:
https://foobar.withgoogle.com/
https://www.freecodecamp.org/news/the-foobar-challenge-googles-hidden-test-for-developers-ed8027c1184/

Related Articles