Code Monkey home page Code Monkey logo

google-foobar's Introduction

Software License

(c) 2017 Sage Callon.

In this repository I'll post my solutions to Google Foobar from level 2 and onwards. I found out after completing level 1 that there's no way to access my code for that submission, so that won't be on this repository.

What's Google Foobar?

Google Foobar is a timed coding challenge you can receive from Google if you're caught looking up programming terms using their search engine! I got my invitation while looking up documentation for the Python standard library, and used it as an opportunity to sharpen my Python skills.

You get given a time limit for each challenge, ranging from a day to a few weeks, and your code is run against hidden test cases โ€” including how fast and memory-efficient it is!

I completed this challenge, and have no work left to do on it unless Google sends me more.

Disclaimer

The code on this repository is for educational purposes. If you are taking the Google Foobar Challenge and on this repository, I encourage you take my test cases and look into the algorithms I list in each subsection below.

You are doing yourself a great disservice if you just copy/paste my solutions, and I have intentionally left a few files that do not work on this repository.

The Challenges

Level 1

This level had a problem about counting duplicate occurrences of characters in a string.

Level 2

In this level, I was confronted with the Knight's Shortest Path Algorithm, and Array Multiplication with a lot of conditional cases to account for.

  • Don't Get Volunteered
  • Power Hungry

Level 3

On this level, the challenges began to become more complicated. I encountered Breadth-First Search with conditional passthrough, Euler's Distinct Partitions, and a Lucky Triplets problem.

  • Prepare the Bunnies' Escape
    • My first attempt at this problem tried to re-use code from level 2 where I performed a depth-first search, but that was too slow.
    • For my second attempt, I employed breadth-first search and sacrificed some memory for performance.
  • The Grandest Staircase Of Them All
  • Find the Access Codes
    • My first algorithm for tackling this problem was O(n3).
    • The second one was much better optimized, running in O(n2).

Level 4

On this level, I dealt with a Combinations problem, and an instance of the Traveling Salesman Problem.

  • Free the Bunny Prisoners
  • Running With Bunnies

Level 5

This level was the hardest by far, and took me to the whiteboard. I dealt with Cellular Automata Pre-imaging, and had to go read some academic papers to solve this one.

  • Expanding Nebula
    • For my first attempt, I used an algorithm that produced every possible pre-image. This was horribly slow, and so I had to try again.
    • My second attempt was the fastest algorithm, but failed because the memory consumption when using a cache was too high.
    • My third attempt, and final submission, just avoided as many unnecessary computations as possible.

Secret Follow-up Challenge

While not a formal level of the coding challenge, I encountered a fun Cryptography challenge at the end. If you get this far... you should know what to do!

  • For Your Eyes Only

My Whiteboard

Can you guess what challenge this was?

Whiteboard

google-foobar's People

Contributors

foxhub avatar

Watchers

James Cloos avatar Josiah Bryan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.