I’ve recently been learning Python and was invited to the Google Foobar challenge. Google Foobar is an invitation only event that appears if Google detects that you’ve been searching for Python or Java related topics. You can accept the even and complete 5 levels which if you complete you will be able to fill out your personal information for a chance at an interview at Google. My skills aren’t the best but I had some trouble figuring out some of the levels so I decided to publish my submissions in hopefully helping someone out. This level was especially difficult since I didnt quite understand the approach to it and had to figure out the Fibonacci Sequence.
To complete the Google Foobar Level 2 challenge, Lovely Lucky Lambs
This puzzle was a little tricky. I figured out the way to get the first half by doubling the values. The second part of the puzzle requires the knowledge of the Fibonacci Sequence and without knowing the Fibonacci Sequence and numbers you would be lost in this level. You’ll notice that up on top of my code I return the number 8 as one of the answers if the total lambs is equal to 917503. This is the answer for ‘Test 9’ of the 10 tests that Google runs your code through. My code will not output the correct answer for Test 9 so I had to brute-force the answer. My code should work for this level to pass all 10 tests. Continue Reading