Skip to content

Latest commit

 

History

History

01-02 Array pair sum

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Array Pair Sum

Problem

Given an integer array, output all the unique pairs that sum up to a specific value k.

So the input:

pair_sum([1,3,2,2],4)

would return 2 pairs:

 (1,3)
 (2,2)

NOTE: FOR TESTING PURPOSES CHANGE YOUR FUNCTION SO IT OUTPUTS THE NUMBER OF PAIRS

Code

Create your solution in the form:

def pair_sum(arr: List, k: int) -> int:
    pass

Examples

>>> pair_sum([1,3,2,2],4)
2