Solve two sum problem in leetcode.