Created
November 16, 2014 00:49
-
-
Save andreydung/47d6fed828d3f92b7144 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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