Pergunta de entrevista da empresa Ciena

Experience, a coding question to show I understand the logic.