Skip to content

Instantly share code, notes, and snippets.

@julienp
Created May 25, 2011 11:41
Show Gist options
  • Save julienp/990820 to your computer and use it in GitHub Desktop.
Save julienp/990820 to your computer and use it in GitHub Desktop.
#http://www.bittorrent.com/company/about/developer_challenge
from itertools import combinations
def check_solution(solution):
for (o1, o2, o3) in combinations(solution, 3):
if abs(o1 - o2) == abs(o2 - o3):
return False
return True
print(sum(map(check_solution, combinations(range(40), 9))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment