ShopUp interview question

Leetcode two sum problem optimized