private static bool isAnagram(string str1, string str2)
{
if (str1.Length != str2.Length) {
return false;
}
char[] string1Array = str1.ToCharArray();
char[] string2Array = str2.ToCharArray();
Array.Sort(string1Array);
Array.Sort(string2Array);
if (string1Array.SequenceEqual(string2Array))
{ return true; }
return false;
}
No comments:
Post a Comment