Bloomberg interview question

i was asked two sum leetcode question