Pergunta de entrevista da empresa Braze

I'm guessing some typical HackerRank question.