Skip to content

Instantly share code, notes, and snippets.

@andreydung
Created November 16, 2014 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreydung/47d6fed828d3f92b7144 to your computer and use it in GitHub Desktop.
Save andreydung/47d6fed828d3f92b7144 to your computer and use it in GitHub Desktop.
compatible = 0
N = len(s1)
for i in range(N):
for j in range(i + 1, N):
if (s1[i] == s1[i] and s2[i] == s2[j]) or (s1[i] != s1[j] and s2[i] != s2[j]):
compatible += 1
return compatible/(N*(N - 1)/2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment