rewrite leetcode two sum