Created
November 5, 2023 17:21
-
-
Save vallahor/f553a8914c88f7d01a62f6e85f719ac7 to your computer and use it in GitHub Desktop.
short anagram check
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
def is_anagram(s1, s2): | |
if len(s1) != len(s2): | |
return False | |
result = 0 | |
for c1, c2 in zip(s1, s2): | |
result ^= ord(c1) ^ ord(c2) | |
return result == 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment