DEV Community

Discussion on: IsAnagram? - Quick Hack

Collapse
 
kgb33 profile image
Kelton

I'm curious as to why you used sets rather than a sorted list.

You said you're using sets because they "use an orderly arrangement of alphabets", I thought python sets are unordered.

Also, a set cannot have duplicate elements, so wouldn't "apple" and "leap" return True despite not being anagrams?

Collapse
 
shyams1993 profile image
Shyam Salil

That’s a brilliant catch! Thank you. I will change this post to reflect that :)