Pregunta de entrevista de Arista Networks

1st stage: HackerRank easy to medium problem