Curiosity Gym interview question

Write code to solve a puzzle.