Advertisement
SureDrope

Untitled

May 16th, 2022
526
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def find_sum(arr, x):
  2.     cache = {}
  3.     for i in arr:
  4.         if (x - i) in cache:
  5.             return (i, x - i)
  6.         if i not in cache:
  7.             cache[i] = 1
  8.     return -1
  9.  
Advertisement
RAW Paste Data Copied
Advertisement