Solving Caesar Cipher
In this post I will share my experience solving the first Google FooBar Challenge
.
While doing some search on Google, I received an invitation to participate in a code challenge by Google. I had no previous idea about it, frankly never heard of it. I accepted the invitation and I was redirected to FooBar. After log in, a CLI
with the instructions about the challenge and how to request a challenge was provided. The challenge had to be solved within 2 days.
The Challenge
Decrypt a code where every lowercase letter [a..z] is replaced with the corresponding one in [z..a], while every other character (including uppercase letters and punctuation) is left untouched. That is, 'a' becomes 'z', 'b' becomes 'y', 'c' becomes 'x', etc. For instance, the word "vmxibkgrlm", when decoded, would become "encryption".
Constraints for the solution:
- Java 8
- Limited execution time
- Prohibit usage of third-party libraries
- Parallel processing disabled
- Character limit to around 3000 (I don’t remember exactly)