Pergunta de entrevista da empresa Tickertape

How would you solve this problem