Pregunta de entrevista de Riot Games

Had me build out a fairly simple algorithm.