UKG Interview Question

2 sum problem of leetcode