rewrite leetcode 3sum