Google Doodle Coding Bunny Level 6 Solution

Have you seen the google doodle celebrating 50 years of kids coding? You can find it here in case you’ve missed it:

This is a mini-game where you can program the movement of the bunny in order to eat all the carrots on the field. The game consists of six difficulty levels. To find the “shortest” solution to the last level can be challenging even for seasoned professionals. How can it be? Possibly because experienced developers try to find the optimal solution where the bunny collects the carrots in the least amount of steps. Whereas, the authors are looking for the shortest code – least amount of symbols to describe the algorithm.

Spoiler alert! Please find my solution below. It takes advantage of the fact that our bunny cannot fall into the abyss – as if there was an invisible fence around the field.

Frequent Coding Interview Exercises

I often conduct Java core competency interviews to support my current firm’s effort to bring in new talent. Most candidates are coming in reasonably prepared regarding theoretical knowledge at least. However, they often surprise me how a coding exercise catches them off guard – typical for fresh graduates. Here the intention is to use the produced code as a starting point for further discussions around coding paradigms and language constructs. This often gets crippled because we hardly finish with the coding bit in time.

You might think that the exercises are way too complex, but the truth is that they are not. I invite you to have a look if you are interested. In order to help rookie interviewers and interviewees, I decided to create a git repository to collect the most common coding assignments. The repository might be small for now, but I intend to add more stuff to it over time. Because I truly believe in test-driven-development each assignment has its own dedicated test class. To be up-to-date with the latest technology tests are written using the new JUnit5 framework.

The repository is available here: