Motive interview question

Leetcode style two sum problem