Pergunta de entrevista da empresa Deloitte

I was asked to solve some puzzles.