Java code to solve the three puzzles by Spotify.