Advertisement
Guest User

Untitled

a guest
Aug 30th, 2015
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. def pairs(boys, girls, diff):
  2. a = 0
  3. to_return = 0
  4. if len(boys) == 0 and len(girls) == 0:
  5. return 0
  6. for index1, value1 in enumerate(boys):
  7. for index2, value2 in enumerate(girls):
  8. if abs(value2-value1) <= diff:
  9. #print boys[0:index1] + boys[index1 + 1:], girls[0:index2] + girls[index2 + 1:]
  10. a = 1 + pairs(boys[0:index1] + boys[index1 + 1:],girls[0:index2] + girls[index2 + 1:], diff)
  11. if to_return<a:
  12. to_return = a
  13. return to_return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement