Pregunta de entrevista de Bloomberg

Similar to medium difficulty leetcode questions.