improved 3Sum, skipping duplicates rather than removal