Pergunta de entrevista da empresa Infosys

They asked me to solve a puzzle