Skip to content

Instantly share code, notes, and snippets.

@vallahor
Created November 5, 2023 17:21
Show Gist options
  • Save vallahor/f553a8914c88f7d01a62f6e85f719ac7 to your computer and use it in GitHub Desktop.
Save vallahor/f553a8914c88f7d01a62f6e85f719ac7 to your computer and use it in GitHub Desktop.
short anagram check
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