Tech Mahindra interview question

two sum from leetcode medium