Pergunta de entrevista da empresa Mews

Easy algorithm question from the manager ; )