Given a list of integers (assume no duplicates), return the number of pairs that add up to a specific target. You may not use the same eleme
twice. If the list is None or its length is less than 2, return 0.
Examples:
nums = [2, 11, 7, 15], target = 9 -> 1
Why? Only 1 pair (2,7) that adds up to 9
nums = [8, 0, 9, -1, -17, 10, 1], target = 9 -> 3
Why? There are 3 pairs that add up to 9: (8, 1) (0, 9) (-1, 10)
nums = [10, -5, 7], target = 4 -> 0
Why? There are no pairs that add up to 4
nums = [5, 3], target = 10 -> 0
Why? There are no pairs that add up to 10
nums = [5, 3], target = 6 -> 0
Why? There are no pairs that add up to 6
[] def two_sum_pairs(nums, target):
return -1