Pregunta de entrevista de Fidessa

2 simple hackerrank question.. medium to easy difficulty