Gemini Solutions interview question

One puzzle and one coding question