has pair with sum

Run Settings
LanguagePython
Language Version
Run Command
def hasPairWithSum(arr, s): # create a dictionary / set which contains the value of the sum - arr[i] findSet = set() for i in arr: if i in findSet: return True else: findSet.add(s-i) return False a = hasPairWithSum([1,5,4,5], null) print(a)
Editor Settings
Theme
Key bindings
Full width
Lines