Pergunta de entrevista da empresa Infosys

Asked a Puzzle to solve, it was a real time problem.