I was reading up on dependency injections in Go and saw a “Curious developers are known to seek interesting problems. Solve one from Google?” prompt appear in the Google search bar. In this blog post, I’ll provide solutions to those that I have solved up to the one that I couldn’t.
Reference: Google Foobar
Braille Translation
Braille is a reading and writing system for visually impaired people. It’s composed of 6 dots (“Braille cell”) that’s ordered topdown, leftright using bumps and dots as such.
Each of the Braille cells represents a symbol in a natural language. In the foobar challenge, that symbol range was basic Latin alphabets  lowercase and uppercase  and a space. Thankfully, as this constraint allowed me to not consider punctuations, the following table from the Wikipedia Braille article was extremely helpful to solve this problem.
It’s important here to recognize the colors red, green, and purple. The positions 3, 36, and 6 act like a control mechanism to provide derivatives to the repeating set: 1, 2, 4, 5. Also interestingly, the ‘w’ is in its own set because the French alphabet did not have that letter when Louis Braille invented the Braille alphabet back in the 1800s! Another interesting observation is that the repeating set doesn’t have these variants.
After trying to read my apartment’s Braille fire escape instructions just using my fingers, I think that’s because it’s difficult to differentiate the above with zero visual guidance. Nonetheless, I decided to hack together a crude replication of the Braille table from Wikipedia and add the problem’s additional capitalization and space constraints.


Bunny Worker Locations
In this problem, we are given a right triangle that’s formed as a successive diagonal series.
The task is to find which number is at (x, y)
where x
and y
are both in (0, 100,000]
range as such.
x  y  (x, y) 

1  1  1 
3  2  9 
5  10  96 
We can use quadratic sequences  but that would require finding the formula for each y
set using the difference method. Instead we can observe and tie in a few number patterns to get to a muchfaster solution of a constant time.
First, as you probably noticed as well, the y=1
number series is basically the addition of the x
axis.
So we can deduce that we can get any x
th of y=1
by using this formula.
But this doesn’t accurately reflect if x > 1
.
This is another important relationship between the y
axis and x=1
.
And as you probably saw it as well, the x=1
is the addition of y
axis minus the last.
So we can deduce that we can get any y
th of x=1
by using this formula.
So far we can calculate the “edges” of x
and y
axis. Now we just need to add in the organic growth of x * (y1)
.


Don’t Get Volunteered!
This problem is very similar to a dynamic programming challenge about finding the minimal movement for a knight to get from a position (a, b)
to (x, y)
. However, the difference is that a knight’s starting and end positions are given as an array’s position instead of a 2dimensional index.
For example, we would need to find the minimum moves from position “5” to “12” instead of (5, 0)
to (4, 1)
.
So aside from the traversal logic, we can get around the above subproblem by preprocessing the position values to their respective (x, y)
coordinates based on the below coordinate mapping.
My solution utilizes breadthfirstsearch (BFS) and coordinate index conversion logic.


Bomb, Baby!
Unfortunately I was blocked here because I didn’t understand the instructions.
Every Mach bomb retrieves a sync unit from a Facula bomb; for every Mach bomb, a Facula bomb is created;
When I read “X retrieves a sync unit from Y”, I kept thinking about mutexes or semaphores so I wasn’t sure if the “Facula bomb” is an array composed of ‘syncable’ elements and for each pop goes to the “Mach bomb”.
Every Facula bomb spontaneously creates a Mach bomb.
I think here the word “spontaneously” kind of threw me off. The way I interpreted this was if something is spontaneous, that would infer that it’s nondeterministic. So Facula bomb may or may not generate a Mach bomb  which can be expressed using probabilities. But no probability thresholds were given so I was a bit stuck. So my guess is that the challenge wanted to use some kind of generation or genetic algorithms so that I can fully expand on the children of the Mach and Facula bombs.