Pergunta de entrevista da empresa Block

I was asked an easy LeetCode question.