Baidu interview question

Leetcode - 1: two sum