Skip to content

Instantly share code, notes, and snippets.

@dbulgakov
Created December 9, 2017 11:56
Show Gist options
  • Select an option

  • Save dbulgakov/8f152e9d99e01600f49a9c8dbd70b3b2 to your computer and use it in GitHub Desktop.

Select an option

Save dbulgakov/8f152e9d99e01600f49a9c8dbd70b3b2 to your computer and use it in GitHub Desktop.
160
import itertools
hh = list(itertools.product([0, 1], repeat=9))
a = "101101101"
b = "001011001"
def f(s1, s2):
assert len(s1) == len(s2)
return sum(i != j for i, j in zip(s1, s2))
def hi():
counter = 0
for h in hh:
tmp = ''.join(str(x) for x in h)
if f(a, tmp) + f(b, tmp) == 8:
counter += 1
print(counter)
hi()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment