Pergunta de entrevista da empresa Applied Intuition

First interview was a typical leetcode-style question, maybe easier side of a medium. The interviewer was relatively friendly, and asked at the end of the interview how I'd clean up the code if in a production environment