Domanda di colloquio di Bloomberg

i was asked two sum leetcode question