Dayforce interview question

Leetcode Two Sum solve it.