/FOOBAR

This repo contains the code i made for the Google Foobar Challenge

Primary LanguagePython

FOOBAR 2020

Hay Folks!!, This repository consists of the Python code I made during the FOOBAR CHALLENGE. I had also given a brief idea about the approch and algorithm I used in those questions.

  • Re-ID

    This was the very first question I encountered in the FOOBAR CHALLENGE, and it deals with prime numbers. From the word prime number the thing that came to my mind was the Sieve of Eratosthenes and I used it for the question. Since the constraints of this problem is relatively low(about 1e5) , one can also use bruteforce for the solution.


  • Lovely Lucky LAMBs

    This problem was intituative demands logical thinking. The optimum answer will be Fibonacci(for max) and power of 2(for min).

  • Hey, I Already Did That!

    This problem deals with base conversion and hash map(to check for the cycle)


  • Find the Access Codes

    This problem was very confusing and consumed a lot of my time. The problem states a defination for Lucky Triples and ask you to find total number of lucky triples in a given array. "The Lucky Triple need not to be unique" this line wa smissing in the problem statement which made me think in a diffrent way to eliminate the duplicate whict was not necessary.

  • Bomb, Baby!

    This was an intuitive problem which required loggical reasoning. I used approch similar to Euler's Theorem for GCD to get my worked done in this problem.

  • Prepare the Bunnies' Escape

    This was a problem based of Graph Data Structure. The problem statement comesup with an idea of a 0-1 maze in which. I used BFS to find my way out of the maze and also a function to change the position of walls one at a time.


  • Escape Pods

    This problem deals with a directed graph.Since it a Directed graph, the word that ring my ears was DFS and I used it for the problem. It too me 1 day to come up with a proper solution because graph data structure was new to me.

  • Running with Bunnies

    This was the Hardest problem of the challenge according to me. The problem is a combination of Travelling Salesman problem and Bellman-Ford Algorithm . As I was new to graph and didn't know these alogorithms well, it took be a lot of days to comeup with a proper answer. I also searched the problem on google to solve it , hence i don't take the credit to solve it by my self.


  • Dodge the Lasers!

    After 3 problems on Graph, this problem was on Mathematics. The problem asks you to write a function that returns the value

    floor(1*sqrt(2))+floor(2*sqrt(2))+floor(3*sqrt(2))+....................floor(n*sqrt(2))

    At first glance, it seemed very easy to me(iterrative approach) ,but the constraints were too high(1e100) for iterration.Soon i found and article which states a thorem which may help in solving the problem. Moreover we need sqare root of 2 till 100 place(which is not possible in the built-in function) so i used the value of (sqrt(2)-1) till 100th place from google, and I completed the problem



FOOBAR COMPLETED

Bunny dance



If you like this repo, Consider giving it a star and endorse me on LinkedIn

Thank You