Chubb interview question

Leetcode two sum question as in the normal problem