HashMap--TwoSum--avoid duplicate calculation