Solution for problem [Two Sum]