Pergunta de entrevista da empresa OpenSymmetry

They asked me a logic problem