Pergunta de entrevista da empresa Naumen

There was some logic task, but I can't remember it