fork download
  1. arr1 = [0, -1, 2, -3, 1]
  2. s = -2
  3. x = {}
  4.  
  5. for i in arr1:
  6. # Target complement logic: if (s - i) is in the dictionary, a pair exists
  7. if s - i in x:
  8. print("Found")
  9. break
  10. else:
  11. x[i] = 1
Success #stdin #stdout 0.07s 14072KB
stdin
Standard input is empty
stdout
Found