Pregunta de entrevista de Aleph (NY)

Ad-hoc HackerRank problem, no weird algorithms required. Language of your choice.