Pergunta de entrevista da empresa Klaviyo

Here is the code. Please fix it to make it more efficient with less overhead.