Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.20 KB | None | 0 0
  1. x = [1,2,4,3,5,6,7,8,9]
  2.  
  3. def f(x, target):
  4. for i in range(0, len(x) -1):
  5. value = (target / x[i])
  6. if value in x:
  7. yield (int(value), x[i])
  8.  
  9. print(list(f(x, 18)))
  10.  
  11. # O(n) linear
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement