Pergunta de entrevista da empresa Block

General coding question - medium difficulty