Pregunta de entrevista de Bloomberg

leetcode question from their tagged - medium