Pregunta de entrevista de Robinhood

they were 2 leetcode hard problems